initialise attributes after a resource is created by an InheritedResources controller
This commit is contained in:
parent
7bf683d8f4
commit
c2c0b86c3a
|
@ -6,7 +6,13 @@ module CanCan
|
|||
@controller.send :association_chain
|
||||
@controller.instance_variable_get("@#{instance_name}")
|
||||
elsif new_actions.include? @params[:action].to_sym
|
||||
@controller.send :build_resource
|
||||
|
||||
resource = @controller.send :build_resource
|
||||
initial_attributes.each do |attr_name, value|
|
||||
resource.send("#{attr_name}=", value)
|
||||
end
|
||||
resource
|
||||
|
||||
else
|
||||
@controller.send :resource
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user