Class: CanCan::InheritedResources

Inherits:
ControllerResource
  • Object
show all
Defined in:
lib/cancan/inherited_resources.rb

Instance Method Summary collapse

Instance Method Details

#load_resource_instanceObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cancan/inherited_resources.rb', line 18

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

#resource_baseObject



30
31
32
# File 'lib/cancan/inherited_resources.rb', line 30

def resource_base
  @controller.send :end_of_association_chain
end