-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class Movie < ActiveRecord::Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class CreateMovies < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table 'movies' do |t| | ||
t.string 'title' | ||
t.string 'rating' | ||
t.text 'description' | ||
t.datetime 'release_date' | ||
# Add fields that let Rails automatically keep track | ||
# of when movies are added or modified: | ||
t.timestamps | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
# This file should ensure the existence of records required to run the application in every environment (production, | ||
# development, test). The code here should be idempotent so that it can be executed at any point in every environment. | ||
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). | ||
# | ||
# Example: | ||
# | ||
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name| | ||
# MovieGenre.find_or_create_by!(name: genre_name) | ||
# end | ||
# Seed the RottenPotatoes DB with some movies. | ||
more_movies = [ | ||
{ title: 'My Neighbor Totoro', rating: 'G', | ||
release_date: '16-Apr-1988' }, | ||
{ title: 'Green Book', rating: 'PG-13', | ||
release_date: '16-Nov-2018' }, | ||
{ title: 'Parasite', rating: 'R', | ||
release_date: '30-May-2019' }, | ||
{ title: 'Nomadland', rating: 'R', | ||
release_date: '19-Feb-2021' }, | ||
{ title: 'CODA', rating: 'PG-13', | ||
release_date: '13-Aug-2021' } | ||
] | ||
|
||
more_movies.each do |movie| | ||
Movie.create!(movie) | ||
end |