instance method
define_method_attribute=
Ruby on Rails 8.0.4
Since v5.2.8.1 PrivateSignature
define_method_attribute=(canonical_name, owner:, as: canonical_name)
No documentation comment.
Parameters
-
canonical_namereq -
ownerkeyreq -
askey = canonical_name
Source
# File activemodel/lib/active_model/attributes.rb, line 92
def define_method_attribute=(canonical_name, owner:, as: canonical_name)
ActiveModel::AttributeMethods::AttrNames.define_attribute_accessor_method(
owner, canonical_name, writer: true,
) do |temp_method_name, attr_name_expr|
owner.define_cached_method(temp_method_name, as: "#{as}=", namespace: :active_model) do |batch|
batch <<
"def #{temp_method_name}(value)" <<
" _write_attribute(#{attr_name_expr}, value)" <<
"end"
end
end
end
Defined in activemodel/lib/active_model/attributes.rb line 92
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Attributes::ClassMethods