Ruby on Rails - manually testing your models in ruby on rails- ruby on rails tutorial - rails guides - rails tutorial - ruby rails
Manually Testing your Models in Ruby on Rails
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:
Then, to show that record, you could run:
Or if this is your first or only record, you could simply get the first record by running: