Skip to content

Commit

Permalink
Added recipie model to database
Browse files Browse the repository at this point in the history
  • Loading branch information
begonaguereca committed Jan 23, 2021
1 parent 7806596 commit f92baaa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/models/recipe.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Recipe < ApplicationRecord
validates :name, presence: true
validates :ingredients, presence: true
validates :instruction, presence: true
end
11 changes: 11 additions & 0 deletions db/migrate/20210123062555_create_recipes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateRecipes < ActiveRecord::Migration[6.1]
def change
create_table :recipes do |t|
t.string :name, null: false
t.text :ingredients, null: false
t.text :instruction, null: false
t.string :image, default: 'https://raw.githubusercontent.com/do-community/react_rails_recipe/master/app/assets/images/Sammy_Meal.jpg'
t.timestamps
end
end
end

0 comments on commit f92baaa

Please sign in to comment.