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 - Ruby on Rails Tutorial
From the course: Ruby on Rails 5 Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
ActiveRecord and ActiveRelation4m 32s
-
(Locked)
Model naming5m 52s
-
(Locked)
Model attributes2m 51s
-
(Locked)
The Rails console3m 17s
-
(Locked)
Create records4m 53s
-
(Locked)
Update records3m 16s
-
(Locked)
Delete records2m 29s
-
(Locked)
Find records5m 48s
-
(Locked)
Query methods: Conditions7m 39s
-
(Locked)
Query methods: Order, limit, and offset6m 29s
-
(Locked)
Named scopes8m 26s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-