Skip to content

Commit

Permalink
rewrite in Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
a2ikm committed Jul 30, 2011
1 parent 4929e09 commit 6595eef
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions README.md
@@ -1,28 +1,31 @@
== activerecord-and-mongoid-sample

# activerecord-and-mongoid-sample

We can use ActiveRecord and Mongoid in one app.
This Rails3 app is that sample.


=== Installing Mongoid
## Installing Mongoid

Add 'bson_ext' and 'mongoid' to Gemfile, and run `bundle`.
Then run `rails g mongoid:config` to generate a configuration file for Mongoid.


=== Creating Model Files
## Creating Model Files

After installing mongoid, 'model' generator is for Mongoid.

$ r g model todo_log title:string done:boolean
invoke mongoid
create app/models/todo_log.rb
<pre>
$ r g model todo_log title:string done:boolean
invoke mongoid
create app/models/todo_log.rb
</pre>

So, when you're creating an ActiveRecord model file,
use 'active_record:model' generator.

$ r g active_record:model todo title:string done:boolean
create db/migrate/20110730071022_create_todos.rb
create app/models/todo.rb


<pre>
$ r g active_record:model todo title:string done:boolean
create db/migrate/20110730071022_create_todos.rb
create app/models/todo.rb
</pre>

0 comments on commit 6595eef

Please sign in to comment.