Upgrade Mongoid - Default Type for Field

If you have watched the episode about mongoid from railscast, ryanb removed the default type String for field, like

class Article
  field :name, :type => String
  field :content, :type => String
end

can be written as

class Article
  field :name
  field :content
end

but it is not valid from mongoid.2.0.0.rc.1 again, the default type of field is changed from String to Object, that means we should explicitly set the type for each field.

Posted in  mongoid ruby


blog comments powered by Disqus
Fork me on GitHub