attribute_method?

attribute_method?(attribute)
Instance Public methods

Returns true if attribute is an attribute method and table exists, false otherwise.

1
2
3
4
5
6
class Person < ActiveRecord::Base
end
 
Person.attribute_method?('name')   # => true
Person.attribute_method?(:age=)    # => true
Person.attribute_method?(:nothing) # => false
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.