Refactor out attribute assignment
This commit is contained in:
parent
b965f5bab4
commit
88aba4664a
|
@ -7,10 +7,7 @@ module CanCan
|
||||||
@controller.instance_variable_get("@#{instance_name}")
|
@controller.instance_variable_get("@#{instance_name}")
|
||||||
elsif new_actions.include? @params[:action].to_sym
|
elsif new_actions.include? @params[:action].to_sym
|
||||||
resource = @controller.send :build_resource
|
resource = @controller.send :build_resource
|
||||||
initial_attributes.each do |attr_name, value|
|
assign_attributes(resource)
|
||||||
resource.send("#{attr_name}=", value)
|
|
||||||
end
|
|
||||||
resource
|
|
||||||
else
|
else
|
||||||
@controller.send :resource
|
@controller.send :resource
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user