🕵️‍♀️ Task

Select all records from the movies table.

movies

  • id (integer)
  • title (string)
  • year (integer)
  • duration (integer)
  • description (text)
  • image (string)
  • director_id (integer)

directors

  • id (integer)
  • name (string)
  • dob (date)
  • bio (text)
  • image (string)

actors

  • id (integer)
  • name (string)
  • dob (date)
  • bio (text)
  • image (string)

characters

  • id (integer)
  • actor_id (integer)
  • movie_id (integer)
  • name (string)
📖Method

The all method returns an ActiveRecord::Relation from the designated Class.

An ActiveRecord::Relation is an object that contains a list of rows/records from the database table that is connected to the Class that is calling the method.

A table can be referenced by it’s associated model. A “model” is a Ruby Class that inherits from ActiveRecord::Base.

class Movie < ActiveRecord::Base end
class Director < ActiveRecord::Base end
class Actor < ActiveRecord::Base end
class Character < ActiveRecord::Base end