Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
v1.2.4 - fix params type checking in nested attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
westonganger committed Sep 22, 2016
1 parent 7567c9d commit f4057b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.2.4

* Fixed params type checking with nested attributes

## 1.2.3

* Fixed ArgumentError with nested attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@ def assign_nested_attributes_for_one_to_one_association(association_name, attrib
def assign_nested_attributes_for_collection_association(association_name, attributes_collection, assignment_opts = {})
options = self.nested_attributes_options[association_name]

class_name = attributes_collection.class.name

if class_name == 'ActionController::Parameters'
if attributes_collection.class.name == 'ActionController::Parameters'
attributes_collection = attributes_collection.to_unsafe_h
elsif !['Hash','Array'].include?(class_name)
elsif !attributes_collection.is_a?(Hash) && !attributes_collection.is_a?(Array)
raise ArgumentError, "ActionController::Parameters or Hash or Array expected, got #{attributes_collection.class.name} (#{attributes_collection.inspect})"
end

Expand Down
2 changes: 1 addition & 1 deletion lib/protected_attributes/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ProtectedAttributes
VERSION = "1.2.3"
VERSION = "1.2.4"
end

0 comments on commit f4057b2

Please sign in to comment.