MongoDb MongoMapper and Rails Oh MY!

For the past couple of hours I am trying to insert a simple document
into MongoDb database using Rails and MongoMapper. There is no error
but the document never gets inserted. Here is my simple class:

class Post
include MongoMapper::Document

key :title, String, :required => true
key :description, String

end

My database.yml file:

development:
adapter: mongodb
host: localhost
database: blog

test: &TEST
adapter: mongodb
host: localhost
database: blog_test

production:
adapter: mongodb
host: localhost
database: blog

and my mongodb.rb file in initializer:

db_config = YAML::load(File.read(RAILS_ROOT + “/config/database.yml”))

if db_config[Rails.env] && db_config[Rails.env][‘adapter’] ==
‘mongodb’
mongo = db_config[‘blog’]
MongoMapper.connection = Mongo::Connection.new(mongo[‘hostname’])
MongoMapper.database = mongo[‘database’]
end

And finally here is the controller create action:

def create

post = Post.new
post.title = 'title'

post.save

redirect_to :action => "new"

end

Have you used the console to query the MongoDB database and confirm
that a document HASN’T been made?

You could also walk through the steps to create a Post object from the
console and see if that is successful. That should help isolate where
the issue is.

And why are you redirecting to new rather than show for the record or
an index of all records?

Cheers,
Walter