Class: CanCan::InheritedResource

Inherits:
ControllerResource show all
Defined in:
lib/cancan/inherited_resource.rb

Overview

For use with Inherited Resources

Instance Method Summary collapse

Methods inherited from ControllerResource

add_before_filter, #authorize_resource, #initialize, #load_and_authorize_resource, #load_resource, #parent?, #skip?

Constructor Details

This class inherits a constructor from CanCan::ControllerResource

Instance Method Details

#load_resource_instanceObject

:nodoc:



4
5
6
7
8
9
10
11
12
13
# File 'lib/cancan/inherited_resource.rb', line 4

def load_resource_instance
  if parent?
    @controller.send :association_chain
    @controller.instance_variable_get("@#{instance_name}")
  elsif new_actions.include? @params[:action].to_sym
    @controller.send :build_resource
  else
    @controller.send :resource
  end
end

#resource_baseObject



15
16
17
# File 'lib/cancan/inherited_resource.rb', line 15

def resource_base
  @controller.send :end_of_association_chain
end