Skip to content

Instantly share code, notes, and snippets.

@yuki24
Created March 6, 2012 02:09
Show Gist options
  • Save yuki24/1982890 to your computer and use it in GitHub Desktop.
Save yuki24/1982890 to your computer and use it in GitHub Desktop.
Mongoid's Mass assignment
> require 'rubygems'
=> false
> require 'mongoid'
=> true
> class Person
> include Mongoid::Document
> end
=> Person
> Person
=> Person
> Person.new
=> #<Person _id: 4f54e4781d41c84c00000001, _type: nil>
> Person.new foo: 123, bar: 456
=> #<Person _id: 4f54e4871d41c84c00000002, _type: nil, foo: 123, bar: 456>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment