On Sun, 20 Jul 2008, Erik R. wrote:
explicitly invoke any accessor method, then the above works as
obj.date # just get the date
k = :date=
obj.method(k).call(new_date) # works now
Interestingly, that will happen when you call any unknown method on
=> #<Team id: 277401923, name: “Persuaders”, mascot: “Cat”, … >
NoMethodError: undefined method `blah’ for #Team:0x242e2d8
=> [“mascot”, “mascot=”, “mascot?”]
method_missing creates the column attributes immediately if they don’t
exist, no matter what. The same thing happens with respond_to?
Is there a good way to ensure that these accessor methods are loaded
I try looking them up with .method()?
You could call define_attribute_methods on the class. That’s basically
what method_missing does.
Rails training from David A. Black and Ruby Power and Light:
Intro to Ruby on Rails July 21-24 Edison, NJ
Advancing With Rails August 18-21 Edison, NJ
See http://www.rubypal.com for details and updates!