respond_to? / methods / method_missing / instance_methods (round 4)

2 views
Skip to first unread message

Student

unread,
Jan 1, 2009, 12:45:38 PM1/1/09
to Ruby on Rails: Core
>> t = Test.new
=> #<Test id: nil, name: nil, created_at: nil, updated_at: nil>
>> Test.public_instance_methods - ActiveRecord::Base.public_instance_methods
=> []
>> t.methods - ActiveRecord::Base.public_instance_methods
=> ["updated_at", "validate_on_update", "updated_at=", "created_at?",
"name", "name=", "validate", "created_at", "created_at=", "name?",
"validate_on_create", "updated_at?"]
>> Test.public_instance_methods - ActiveRecord::Base.public_instance_methods
=> ["updated_at", "updated_at=", "created_at?", "name", "name=",
"created_at", "created_at=", "name?", "updated_at?"]

Test.public_instance_methods is not updated until t.methods has been
called. This would appear to be in error.


Reply all
Reply to author
Forward
0 new messages