Testing your Active Record models through your command line interface is simple.
Navigate to the app directory in your terminal and type in
rails console to start the Rails console. From here, you can run active record methods on your database.
For example, if you had a database schema with a Users table having a
name:string column and
email:string, you could run:
User.create name: "John", email: "firstname.lastname@example.org"
Then, to show that record, you could run:
User.find_by email: "email@example.com"
Or if this is your first or only record, you could simply get the first record by running: