Allow using root = false in initialize

This commit is contained in:
Santiago Pastorino
2013-09-14 21:15:04 -03:00
parent 8462a73f3a
commit 626a85bc3e
4 changed files with 23 additions and 2 deletions

View File

@@ -85,7 +85,8 @@ module ActiveModel
alias read_attribute_for_serialization send
def root=(root)
@root = root || self.class._root
@root = root
@root = self.class._root if @root.nil?
@root = self.class.root_name if auto_assign_root?
end