Wednesday, 29 August 2012

Create a New app Using Mongo db



create new repository using this command:

$ rails new <app_name> -T -O

Use the -T -O flags to skip Test::Unit files and Active Record files.

Ex: $ rails new example_mongo -T -O

include this gems in your gem file:


gem "mongoid", "~> 2.2"    
gem "mongo", "~> 1.5.0.rc0"
gem "bson", "~> 1.5.0.rc0"
gem "bson_ext", "~> 1.5.0.rc0"

go to the repository and run $ bundle update command.

then run $ rails g mongoid:config to generate your configuration file.

try to create a table using scaffold

exp: $ rails g scaffold user name:string email:string

Every thing should go fine... That's it..
:)




No comments:

Post a Comment