Some Commonly Used Ror Commands:

1. For skiping bunlde and using mysql

  rails new [project name] --database=mysql --skip-bundle

2. Listing Gemset:

  rvm gemset list

3. Create a Gemset:

  rvm gemset create xyz

4. For Using GemSet:

goto project directory using ”cd” command

  rvm --rvmrc  --create 1.9.3@xyz
  cd ..
  cd [project]
  press y when terminal say that Do you wish to trust this .rvmrc file?
  rvm gemset list (it will show the current gemset)

Now you can do bundle install

5. Prevents the local installation of any production gems

  bundle install --without production

6. Undo Code Generation:

these two commands cancel each other out:

  rails generate controller FooBars baz quux
  rails destroy controller FooBars baz quux

Similarly, we generate a model as follows:

   rails generate model Foo bar:string baz:integer

This can be undone using

   rails destroy model Foo

We can undo a single migration step using

rake db:rollback

Undo and reapply the last migration

rake db:migrate:redo

To go all the way back to the beginning, we can use

rake db:migrate VERSION=0

7. Run Console in sandbox environment:
In this case all the changes will roll back on exit.

  Rails console --sandbox


  Rails c --sandbox

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s