parent
76b2738b01
commit
29ac49b40d
@ -1,7 +1,7 @@
|
||||
class Review < ApplicationRecord
|
||||
belongs_to :movie
|
||||
belongs_to :user
|
||||
|
||||
validates :name, presence: true
|
||||
validates :comment, length: { minimum: 4 }
|
||||
validates :stars, numericality: { greater_than_or_equal_to: 1, less_than_or_equal_to: 5 }
|
||||
end
|
||||
|
@ -1,4 +1,7 @@
|
||||
class MakeReviewsAJoinTable < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
remove_column :reviews, :name, :string
|
||||
add_column :reviews, :user_id, :integer
|
||||
Review.delete_all
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in new issue