instance method
evaluate_attribute_method
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18 PrivateAvailable in: v2.2.3 v2.3.18
Signature
evaluate_attribute_method(attr_name, method_definition, method_name=attr_name)
Evaluate the definition for an attribute related method
Parameters
-
attr_namereq -
method_definitionreq -
method_nameopt = attr_name
Source
# File activerecord/lib/active_record/attribute_methods.rb, line 204
def evaluate_attribute_method(attr_name, method_definition, method_name=attr_name)
unless method_name.to_s == primary_key.to_s
generated_methods << method_name
end
begin
class_eval(method_definition, __FILE__, __LINE__)
rescue SyntaxError => err
generated_methods.delete(attr_name)
if logger
logger.warn "Exception occurred during reader method compilation."
logger.warn "Maybe #{attr_name} is not a valid Ruby identifier?"
logger.warn err.message
end
end
end
Defined in activerecord/lib/active_record/attribute_methods.rb line 204
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods::ClassMethods