Got it - maybe. I found a good resource[1], but I am not sure I
understand the value of the setter method in the first place. It would
seem that benefit is being able to skip explicitly calling save on an
object. Is that right?
If I had this method defined on my class:
def my_attribute=(some_value)
@some_value = some_value
end
I could call:
@object.my_attribute = new_value
instead of:
@object.my_attribute = new_value
@object.save
Is that the reason to define a setter method?
[1] http://rubylearning.com/satishtalim/ruby_syntactic_sugar.html
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---