method
define_method_attribute=
v3.2.13 -
Show latest stable
- Class:
ActiveRecord::AttributeMethods::Write::ClassMethods
define_method_attribute=(attr_name)protected
No documentation available.
# File activerecord/lib/active_record/attribute_methods/write.rb, line 12
def define_method_attribute=(attr_name)
if attr_name =~ ActiveModel::AttributeMethods::NAME_COMPILABLE_REGEXP
generated_attribute_methods.module_eval("def #{attr_name}=(new_value); write_attribute('#{attr_name}', new_value); end", __FILE__, __LINE__)
else
generated_attribute_methods.send(:define_method, "#{attr_name}=") do |new_value|
write_attribute(attr_name, new_value)
end
end
end