mandate image on posts, update schema

This commit is contained in:
acon 2025-05-05 14:53:21 -04:00
parent b4e7464c07
commit 7f427c6be5
3 changed files with 2 additions and 6 deletions

View file

@ -5,4 +5,5 @@ class Post < ApplicationRecord
validates :description, presence: true
validates :name, presence: true
validates :hours, presence: true, numericality: { less_than_or_equal_to: 5, greater_than_or_equal_to: 0 }
validates :featured_image, presence: true
end

View file

@ -1,5 +0,0 @@
class AddUserIdToPosts < ActiveRecord::Migration[8.0]
def change
add_reference :posts, :user, null: false, foreign_key: true
end
end

2
site/db/schema.rb generated
View file

@ -54,7 +54,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_05_05_014600) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "hours"
t.integer "user_id", null: false
t.integer "user_id"
t.index ["user_id"], name: "index_posts_on_user_id"
end