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 On Tue, Aug 24, 2010 at 9:06 AM, AzamSharp <[email protected]> wrote: > 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 > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

