Refactor out attribute assignment

This commit is contained in:
Mike Pack 2012-06-07 20:11:17 -06:00 committed by Anuj Dutta
parent b965f5bab4
commit 88aba4664a

View File

@ -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