Awesome: Working with the Rails console and all the tricks

Testing your active record methods using script/console

If you are using windows, you start the console by using this command:

ruby script\console
Linux:

./script/console

Just use the following command whenever you make changes to your model objects:

reload!

Instead of accessing your MySQL database with

mysql -u -p

You can instead do

script/dbconsole

and if you database has a password, just do

script/dbconsole -p


% script/dbconsole # connect to development database (or $RAILS_ENV)
% script/dbconsole production # connect to production database

Cheers !

$@ndip

Advertisements

About sandipransing

Web Developer #ruby #rails #JS
This entry was posted in Ruby on Rails and tagged , , . Bookmark the permalink.

One Response to Awesome: Working with the Rails console and all the tricks

  1. […] Awesome: Working with the Rails console and all the tricks « Fun On Rails […]

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s