What exactly does the “Rails development environment” entail?
-
04-03-2021 - |
Question
I'm running Rails 3.1.1 and Ruby 1.8.7. When I type irb
in the OS X Terminal the command prompt ree-1.8.7-2011.03 :001 >
is displayed immediately. When I type rails console
in the terminal the same command prompt appears after a 1-2 second delay. Also the terminal displays Loading development environment (Rails 3.1.1)
.
What exactly does the Rails development environment entail?
Solution
When you do rails console
it's loading the entire Rails stack (controllers, models, helpers, etc. and all the supporting code for those) as well as connecting to your Rails database. When you just do irb
, all you're loading is the Ruby interpreter.
OTHER TIPS
The rails console is a ruby Console with all the fancy stuff from rails and the app from where you are calling the console.
In the rails console you can directly create or find objects from your current app. It will use active record and the database connection. It is a great way to quickly check syntax and logic as you code.