method
define_method_attribute
v6.0.0 -
Show latest stable
- Class:
ActiveRecord::AttributeMethods::Read::ClassMethods
define_method_attribute(name)private
No documentation available.
# File activerecord/lib/active_record/attribute_methods/read.rb, line 11
def define_method_attribute(name)
ActiveModel::AttributeMethods::AttrNames.define_attribute_accessor_method(
generated_attribute_methods, name
) do |temp_method_name, attr_name_expr|
generated_attribute_methods.module_eval def #{temp_method_name} name = #{attr_name_expr} _read_attribute(name) { |n| missing_attribute(n, caller) } end, __FILE__, __LINE__ + 1
end
end