Skip to content
Permalink
Browse files

Generate Movies model

  • Loading branch information
ImsirovicAjdin committed Dec 17, 2019
1 parent 6889c59 commit 3996fa051a4135384af49ca3c725ab83b1d2a883
Showing with 41 additions and 0 deletions.
  1. +3 −0 app/models/movie.rb
  2. +14 −0 db/migrate/20191217211500_create_movies.rb
  3. +17 −0 test/fixtures/movies.yml
  4. +7 −0 test/models/movie_test.rb
@@ -0,0 +1,3 @@
class Movie < ApplicationRecord
belongs_to :user
end
@@ -0,0 +1,14 @@
class CreateMovies < ActiveRecord::Migration[6.0]
def change
create_table :movies do |t|
t.string :title
t.string :description
t.string :img
t.string :cover
t.float :rate
t.references :user, null: false, foreign_key: true

t.timestamps
end
end
end
@@ -0,0 +1,17 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
title: MyString
description: MyString
img: MyString
cover: MyString
rate: 1.5
user: one

two:
title: MyString
description: MyString
img: MyString
cover: MyString
rate: 1.5
user: two
@@ -0,0 +1,7 @@
require 'test_helper'

class MovieTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit 3996fa0

Please sign in to comment.
You can’t perform that action at this time.