🕵️‍♀️ Task

Select the first 5 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

You can limit the number of records in an ActiveRecord::Relation with .limit. You pass an Integer argument to choose the number of records you want to appear in the collection.

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