Module: ActiveManageable::Methods::Auxiliary::Select

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_manageable/methods/auxiliary/select.rb

Instance Method Summary collapse

Instance Method Details

#default_select(method: @current_method) ⇒ Object

Returns the default select attributes for the method from the class attribute that can contain an array of attribute names or a lambdas/procs to execute to return an array of attribute names



30
31
32
33
34
# File 'lib/active_manageable/methods/auxiliary/select.rb', line 30

def default_select(method: @current_method)
  default_selects = defaults[:select] || {}
  attributes = default_selects[method.try(:to_sym)] || default_selects[:all] || []
  attributes.is_a?(Proc) ? instance_exec(&attributes) : attributes
end