From a1254ca1c63276adab09d03d12413972da7ac837 Mon Sep 17 00:00:00 2001 From: Anuj Dutta Date: Tue, 19 Jun 2012 00:13:19 +0100 Subject: [PATCH] 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. --- lib/cancan/controller_resource.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/cancan/controller_resource.rb b/lib/cancan/controller_resource.rb index 83a77d1..f91a10e 100644 --- a/lib/cancan/controller_resource.rb +++ b/lib/cancan/controller_resource.rb @@ -83,6 +83,10 @@ module CanCan def build_resource 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 initial_attributes.each do |attr_name, value| resource.send("#{attr_name}=", value)