Created
October 11, 2010 21:14
-
-
Save luigi/621250 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in mongoid.yml, set autocreate_indexes: true so that the index is created dynamically | |
$ bin/rails c | |
Loading development environment (Rails 3.0.0) | |
irb(main):001:0> class Person | |
irb(main):002:1> include Mongoid::Document | |
irb(main):003:1> field :name | |
irb(main):004:1> field :email | |
irb(main):005:1> index :name | |
irb(main):006:1> end | |
=> {:name=>{:unique=>false}} | |
irb(main):007:0> Person.create!(:name => "John", :email => "[email protected]") | |
=> #<Person _id: 4cb37d8229d5fa3003000001, name: "John", email: "[email protected]"> | |
irb(main):008:0> p = Person.last | |
=> #<Person _id: 4cb37d8229d5fa3003000001, name: "John", email: "[email protected]"> | |
irb(main):009:0> p.name = "Steve" | |
=> "Steve" | |
irb(main):010:0> p.save! | |
=> true | |
irb(main):011:0> p = Person.last | |
=> #<Person _id: 4cb37d8229d5fa3003000001, name: "John", email: "[email protected]"> | |
irb(main):012:0> p.email = "[email protected]" | |
=> "[email protected]" | |
irb(main):013:0> p.save! | |
=> true | |
irb(main):014:0> p = Person.last | |
=> #<Person _id: 4cb37d8229d5fa3003000001, name: "John", email: "[email protected]"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue reported here:
http://github.com/mongoid/mongoid/issues/issue/394