update attribute

def name=(name)
write_attribute(:name, name.capitalize)
end

def name
read_attribute(:name).downcase # No test for nil?
end

Image what will happen if you don’t use read_attribute or write_attribute

def name
name.upcase
end
=!= booom, infinite loops, think it about why

idiomatic adj.  [idi] didaode, fuheyuyanxiguan de

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s