Module: ActiveManageable::Methods::Auxiliary::ModelAttributes
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_manageable/methods/auxiliary/model_attributes.rb
Instance Method Summary collapse
-
#default_attribute_values(method: @current_method) ⇒ Object
Returns the default attribute values for the method from the class attribute that can contain a hash of attribute values or a lambda/proc to execute to return attribute values.
Instance Method Details
#default_attribute_values(method: @current_method) ⇒ Object
Returns the default attribute values for the method from the class attribute that can contain a hash of attribute values or a lambda/proc to execute to return attribute values
39 40 41 42 43 44 |
# File 'lib/active_manageable/methods/auxiliary/model_attributes.rb', line 39 def default_attribute_values(method: @current_method) default_attributes = defaults[:attributes] || {} attributes = default_attributes[method.try(:to_sym)] || default_attributes[:all] || {} attributes = (instance_exec(&attributes) || {}) if attributes.is_a?(Proc) attributes.with_indifferent_access end |