title: how get validation messages from mangomapper using rails console?
body: <p>I am basically teaching myself how to use RoR and MongoDB at the same time.
  I am following the very good book / tutorial : <a href="http://railstutorial.org/" rel="nofollow">http://railstutorial.org/</a></p>
  
  <p>I decided to replace Sqlite3 by MongoDB using the mongomapper gem.
  Everything works out about alright, but I am having some non-blocking little issues that I truly wish I could get rid of.</p>
  
  <p>In chapter 6, when working with validation I got 2 issues:
  - I don't know how to get the validations messages back like with Sqlite3.</p>
  
  <p>The "standard" code is:</p>
  
  <pre><code>$ rails console --sandbox
  &gt;&gt; user = User.new(:name =&gt; "", :email =&gt; "mhartl@example.com")
  &gt;&gt; user.save
  =&gt; false
  &gt;&gt; user.valid?
  =&gt; false
  &gt;&gt; user.errors.full_messages
  =&gt; ["Name can't be blank"]
  </code></pre>
  
  <p>but if I try to do the same with MongoMapper, it throws an error saying that errors is undefined function. So does it mean that this is simply not implemented in mongomapper / mongo driver ? Or is there some other clever way to do this that I could not figure ?</p>
  
  <p>Additional, 2 things here:
  - I following the exemple in the book to the line, so I was expecting to be able to use the console in sandbox mode, but apparently that does not work either:</p>
  
  <pre><code>(...)ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/console/sandbox.rb:1:in `&lt;top (required)&gt;': uninitialized constant ActiveRecord (NameError)
  from /Users/Alex/.rvm/gems/ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/application.rb:226:in `initialize_console'
  from /Users/Alex/.rvm/gems/ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/application.rb:153:in `load_console'
  from /Users/Alex/.rvm/gems/ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/commands/console.rb:26:in `start'
  from /Users/Alex/.rvm/gems/ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
  from /Users/Alex/.rvm/gems/ruby-1.9.2-p136@rails3/gems/railties-3.0.3/lib/rails/commands.rb:23:in `&lt;top (required)&gt;'
  from script/rails:6:in `require'
  from script/rails:6:in `&lt;main&gt;'
  </code></pre>
  
  <p>Also, in the book they call "user" but I need to call "User" (note the capital U) why is that ? Is it like mangomapper does not follow the Ruby naming convention or something ?</p>
  
  <p>And finally, I am trying to validate the field email with a regex as shown in the tutorial. It does not throws any errors at the code, but whenever I try to insert it just won't ever accept it unless I comment out the :format option...</p>
  
  <pre><code>class User
    include MongoMapper::Document   
  
  key :name, String, :required =&gt; true,
                     :length =&gt; { :maximum =&gt; 50 }
  
  key :email, String, :required =&gt; true,
  #                   :format =&gt; { :with =&gt; email_regex },
                      :uniqueness =&gt; { :case_sentitive =&gt; false}
  
  timestamps!
  
  end
  </code></pre>
  
  <p>Any advices you can provide on those topics would help me a lot !</p>
  
  <p>Thanks,</p>
  
  <p>Alex</p>