Fix pull request 640. For some reason github didn't allow a clean merge althought there weren't any conflicts. Fix it so that it's easier to just merge via the UI.

This commit is contained in:
Anuj Dutta 2012-06-19 00:13:19 +01:00
parent 88aba4664a
commit a1254ca1c6

View File

@ -83,6 +83,10 @@ module CanCan
def build_resource def build_resource
resource = resource_base.new(resource_params || {}) resource = resource_base.new(resource_params || {})
assign_attributes(resource)
end
def assign_attributes(resource)
resource.send("#{parent_name}=", parent_resource) if @options[:singleton] && parent_resource resource.send("#{parent_name}=", parent_resource) if @options[:singleton] && parent_resource
initial_attributes.each do |attr_name, value| initial_attributes.each do |attr_name, value|
resource.send("#{attr_name}=", value) resource.send("#{attr_name}=", value)