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}")
|
||||
elsif new_actions.include? @params[:action].to_sym
|
||||
resource = @controller.send :build_resource
|
||||
initial_attributes.each do |attr_name, value|
|
||||
resource.send("#{attr_name}=", value)
|
||||
end
|
||||
resource
|
||||
assign_attributes(resource)
|
||||
else
|
||||
@controller.send :resource
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user