the new and create actions will now build the resource with attributes based on ability conditions hash - closes #114

This commit is contained in:
Ryan Bates
2010-09-03 11:53:47 -07:00
parent 1be5bf7a57
commit a744377ac9
5 changed files with 41 additions and 4 deletions

View File

@@ -206,6 +206,14 @@ module CanCan
message.blank? ? nil : message
end
def attributes_for(action, subject)
attributes = {}
relevant_can_definitions(action, subject).map do |can_definition|
attributes.merge!(can_definition.new_attributes) if can_definition.base_behavior
end
attributes
end
private
def unauthorized_message_keys(action, subject)