Sha256: 7487762b4dd291aad16af1e0ca52a5039a7426370208075d4fed31662b8ffec3

Contents?: true

Size: 562 Bytes

Versions: 33

Compression:

Stored size: 562 Bytes

Contents

module CanCan
  # For use with Inherited Resources
  class InheritedResource < ControllerResource # :nodoc:
    def load_resource_instance
      if parent?
        @controller.send :association_chain
        @controller.instance_variable_get("@#{instance_name}")
      elsif new_actions.include? @params[:action].to_sym
        resource = @controller.send :build_resource
        assign_attributes(resource)
      else
        @controller.send :resource
      end
    end

    def resource_base
      @controller.send :end_of_association_chain
    end
  end
end

Version data entries

33 entries across 33 versions & 9 rubygems

Version Path
cancancan-1.17.0 lib/cancan/inherited_resource.rb
cancancan-1.16.0 lib/cancan/inherited_resource.rb
cancancan-1.15.0 lib/cancan/inherited_resource.rb
cancancan-1.14.0 lib/cancan/inherited_resource.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/cancan-1.6.10/lib/cancan/inherited_resource.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/cancancan-1.13.1/lib/cancan/inherited_resource.rb
cancancan-1.13.1 lib/cancan/inherited_resource.rb
cancancan-1.13.0 lib/cancan/inherited_resource.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/cancancan-1.10.1/lib/cancan/inherited_resource.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/cancancan-1.10.1/lib/cancan/inherited_resource.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/cancancan-1.10.1/lib/cancan/inherited_resource.rb
cancancan-1.12.0 lib/cancan/inherited_resource.rb
cancancan-1.11.0 lib/cancan/inherited_resource.rb
cancancan-1.10.1 lib/cancan/inherited_resource.rb
cancancan-1.10.0 lib/cancan/inherited_resource.rb
cancancan-1.9.2 lib/cancan/inherited_resource.rb
marnen-cancan-2.0.0.alpha.pre.f1cebde51a87be149b4970a3287826bb63c0ac0b lib/cancan/inherited_resource.rb
cancancan-1.9.1 lib/cancan/inherited_resource.rb
cancancan-1.9.0 lib/cancan/inherited_resource.rb
culturecode-cancan-2.0.0.alpha lib/cancan/inherited_resource.rb