Module: Virtus::InstanceMethods::MassAssignment
- Defined in:
- lib/virtus/instance_methods.rb
Overview
Constructor
Instance Method Summary collapse
-
#attributes ⇒ Hash
(also: #to_hash, #to_h)
Returns a hash of all publicly accessible attributes.
-
#attributes=(attributes) ⇒ Hash
Mass-assign attribute values.
Instance Method Details
#attributes ⇒ Hash Also known as: to_hash, to_h
Returns a hash of all publicly accessible attributes
41 42 43 |
# File 'lib/virtus/instance_methods.rb', line 41 def attributes attribute_set.get(self) end |
#attributes=(attributes) ⇒ Hash
Mass-assign attribute values
Keys in the attributes
param can be symbols or strings. All referenced Attribute writer methods will be called. Non-attribute setter methods on the receiver will be called.
70 71 72 |
# File 'lib/virtus/instance_methods.rb', line 70 def attributes=(attributes) attribute_set.set(self, attributes) end |