Class: Locomotive::Api::CanCan::ControllerResource

Inherits:
CanCan::ControllerResource
  • Object
show all
Defined in:
lib/locomotive/cancan.rb

Instance Method Summary collapse

Instance Method Details

#build_resourceObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/locomotive/cancan.rb', line 7

def build_resource
  # FIXME: within the API scope, we do not have to pass directly the params
  # to the new instance because we use presenters instead.
  resource = resource_base.new
  resource.send("#{parent_name}=", parent_resource) if @options[:singleton] && parent_resource
  initial_attributes.each do |attr_name, value|
    resource.send("#{attr_name}=", value)
  end
  resource
end