Class: Spree::Api::V1::BaseController

Inherits:
ActionController::Metal
  • Object
show all
Includes:
ControllerSetup
Defined in:
app/controllers/spree/api/v1/base_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ControllerSetup

included

Instance Attribute Details

#current_api_userObject

Returns the value of attribute current_api_user.



7
8
9
# File 'app/controllers/spree/api/v1/base_controller.rb', line 7

def current_api_user
  @current_api_user
end

Instance Method Details

#map_nested_attributes_keys(klass, attributes) ⇒ Object



19
20
21
22
23
24
25
26
# File 'app/controllers/spree/api/v1/base_controller.rb', line 19

def map_nested_attributes_keys(klass, attributes)
  nested_keys = klass.nested_attributes_options.keys
  attributes.inject({}) do |h, (k,v)|
    key = nested_keys.include?(k.to_sym) ? "#{k}_attributes" : k
    h[key] = v
    h
  end.with_indifferent_access
end