Sha256: f6b751a3dcdad1f33f274b611fb1a88cdac0d29d39b14e59ddd188c9a39f891b

Contents?: true

Size: 613 Bytes

Versions: 30

Compression:

Stored size: 613 Bytes

Contents

module Locomotive
  module Api
    module CanCan

      class ControllerResource < ::CanCan::ControllerResource

        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

      end

    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
locomotive_cms-2.5.7 lib/locomotive/cancan.rb
locomotive_cms-2.5.6 lib/locomotive/cancan.rb
locomotive_cms-2.5.6.rc2 lib/locomotive/cancan.rb
locomotive_cms-2.5.6.rc1 lib/locomotive/cancan.rb
locomotive_cms-2.5.5 lib/locomotive/cancan.rb
locomotive_cms-2.5.4 lib/locomotive/cancan.rb
locomotive_cms-2.5.3 lib/locomotive/cancan.rb
locomotive_cms-2.5.2 lib/locomotive/cancan.rb
locomotive_cms-2.5.1 lib/locomotive/cancan.rb
locomotive_cms-2.5.0 lib/locomotive/cancan.rb
locomotive_cms-2.5.0.rc3 lib/locomotive/cancan.rb
locomotive_cms-2.5.0.rc2 lib/locomotive/cancan.rb
locomotive_cms-2.5.0.rc1 lib/locomotive/cancan.rb
locomotive_cms-2.4.1 lib/locomotive/cancan.rb
locomotive_cms-2.4.0 lib/locomotive/cancan.rb
locomotive_cms-2.3.1 lib/locomotive/cancan.rb
locomotive_cms-2.3.0 lib/locomotive/cancan.rb
locomotive_cms-2.2.3 lib/locomotive/cancan.rb
locomotive_cms-2.2.2 lib/locomotive/cancan.rb
locomotive_cms-2.2.1 lib/locomotive/cancan.rb