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.8.4 lib/cancan/inherited_resource.rb
cancancan-1.8.3 lib/cancan/inherited_resource.rb
cancancan-1.8.2 lib/cancan/inherited_resource.rb
cancancan-1.8.1 lib/cancan/inherited_resource.rb
cancancan-1.8.0 lib/cancan/inherited_resource.rb
cancancan-1.7.1 lib/cancan/inherited_resource.rb
cancancan-1.7.0 lib/cancan/inherited_resource.rb
cancan-1.6.10 lib/cancan/inherited_resource.rb
cancan-1.6.9 lib/cancan/inherited_resource.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/cancan-1.6.8/lib/cancan/inherited_resource.rb
cancan-2-2.0.0.alpha lib/cancan/inherited_resource.rb
cancan-1.6.8 lib/cancan/inherited_resource.rb
cancan-1.6.8.rc1 lib/cancan/inherited_resource.rb