Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merged PR #577

  • Loading branch information...
commit b29c5d30d55294687c207699793c3678edb513c5 1 parent 88bc9de
Sijawusz Pur Rahnama authored
3  lib/cancan/controller_additions.rb
View
@@ -112,6 +112,9 @@ def load_and_authorize_resource(*args)
# [:+prepend+]
# Passing +true+ will use prepend_before_filter instead of a normal before_filter.
#
+ # [:+assignment+]
+ # Passing to ActiveRecord for support Mass-Assignment Role
+ #
def load_resource(*args)
cancan_resource_class.add_before_filter(self, :load_resource, *args)
end
2  lib/cancan/controller_resource.rb
View
@@ -82,7 +82,7 @@ def load_collection
end
def build_resource
- resource = resource_base.new(@params[name] || {})
+ resource = resource_base.new(@params[name] || {}, :as => @options[:assignment])
resource.send("#{parent_name}=", parent_resource) if @options[:singleton] && parent_resource
initial_attributes.each do |attr_name, value|
resource.send("#{attr_name}=", value)
Please sign in to comment.
Something went wrong with that request. Please try again.