From the course: Ruby on Rails 5 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The Rails console

The Rails console - Ruby on Rails Tutorial

From the course: Ruby on Rails 5 Essential Training

Start my 1-month free trial

The Rails console

- [Instructor] The Rails Console, is a powerful tool, which allows us to work with our models directly, without having to worry about having controllers and views. In this movie, we're gonna learn how to use it. The way that you launch the console, is from the command line, you type rails, then console, and then the environment that you want to enter. That's going to be development when I'm developing on my machine. But it could also be production, or test, or maybe you have another environment for staging or QA. By default, it's going to assume that it's the development environment. So, most of the time in development, you're just going to type rails console, or, there's an even shorter shortcut which is just rails c. And that's what I find myself typing the most often. If you have prior experience with Ruby, then you may be familiar with the Ruby Console. That is, irb, or Interactive ruby. If you just type irb from your command line, and you have Ruby installed, you'll then get an…

Contents