diff options
Diffstat (limited to 'interfaces/ruby/models')
-rw-r--r-- | interfaces/ruby/models/post.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/interfaces/ruby/models/post.rb b/interfaces/ruby/models/post.rb index 1d44051..e952aed 100644 --- a/interfaces/ruby/models/post.rb +++ b/interfaces/ruby/models/post.rb @@ -2,6 +2,7 @@ class Post < ActiveRecord::Base has_many :comments has_many :tags, through: :post_tag_links + validates_presence_of :slug validates_presence_of :title validates_presence_of :body end @@ -9,6 +10,7 @@ end class CreatePostTable < ActiveRecord::Migration[6.0] def change create_table :posts do |t| + t.string :slug, null: false, unique: true, index: true t.string :title, null: false t.string :body, null: false t.boolean :locked, default: false |