Sha256: 868bea61d8525e65d7e70db81ec9d20f753c22795cb809cc1ac1eefa0e39d81d

Contents?: true

Size: 441 Bytes

Versions: 5

Compression:

Stored size: 441 Bytes

Contents

module CanCan
  # For use with Inherited Resources
  class InheritedResource < ControllerResource # :nodoc:
    def load_resource_instance
      if parent?
        @controller.send :parent
      elsif new_actions.include? @params[:action].to_sym
        @controller.send :build_resource
      else
        @controller.send :resource
      end
    end

    def resource_base
      @controller.send :end_of_association_chain
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cancan-1.5.1 lib/cancan/inherited_resource.rb
cancan-1.5.0 lib/cancan/inherited_resource.rb
cancan-1.5.0.beta1 lib/cancan/inherited_resource.rb
cancan-1.4.1 lib/cancan/inherited_resource.rb
cancan-1.4.0 lib/cancan/inherited_resource.rb