From 401afb3e9445a8e9c2033962d9f0b6bcc38775e3 Mon Sep 17 00:00:00 2001
From: Marco
Date: Thu, 5 Sep 2024 19:16:32 -0400
Subject: [PATCH 01/13] feat: add basic recipe
---
.idea/Chef.iml | 1 +
Gemfile | 2 ++
Gemfile.lock | 3 +++
db/schema.rb | 9 ++++++++-
db/seeds.rb | 2 +-
5 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/.idea/Chef.iml b/.idea/Chef.iml
index 8d5d4f3..c355f12 100644
--- a/.idea/Chef.iml
+++ b/.idea/Chef.iml
@@ -59,6 +59,7 @@
+
diff --git a/Gemfile b/Gemfile
index 3ea5ff1..8474db6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -87,3 +87,5 @@ end
gem 'devise', '~> 4.9'
gem 'tailwindcss-rails', '~> 2.7'
+
+gem "faker", "~> 3.4", :group => :development
diff --git a/Gemfile.lock b/Gemfile.lock
index 618f514..bd4930e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -118,6 +118,8 @@ GEM
warden (~> 1.2.3)
drb (2.2.1)
erubi (1.13.0)
+ faker (3.4.2)
+ i18n (>= 1.8.11, < 2)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.5)
@@ -345,6 +347,7 @@ DEPENDENCIES
cssbundling-rails
debug
devise (~> 4.9)
+ faker (~> 3.4)
jbuilder
jsbundling-rails
letter_opener (~> 1.8)
diff --git a/db/schema.rb b/db/schema.rb
index 2a6383c..523e223 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,10 +10,17 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.1].define(version: 2024_08_11_230943) do
+ActiveRecord::Schema[7.1].define(version: 2024_09_05_222849) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
+ create_table "recipes", force: :cascade do |t|
+ t.string "title"
+ t.text "description"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
diff --git a/db/seeds.rb b/db/seeds.rb
index 0f16211..eea56c1 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -8,4 +8,4 @@
#
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
# MovieGenre.find_or_create_by!(name: genre_name)
-# end
+# end
\ No newline at end of file
From 38e426de21677e7a158b4ed38ce626450e31d861 Mon Sep 17 00:00:00 2001
From: Marco
Date: Thu, 5 Sep 2024 19:17:11 -0400
Subject: [PATCH 02/13] feat: add basic recipe
---
Gemfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Gemfile b/Gemfile
index 8474db6..107854e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -76,6 +76,8 @@ group :development do
# Preview mail in the browser
gem 'letter_opener', '~> 1.8'
gem 'letter_opener_web', '~> 3.0'
+
+ gem 'faker', '~> 3.4'
end
group :test do
@@ -87,5 +89,3 @@ end
gem 'devise', '~> 4.9'
gem 'tailwindcss-rails', '~> 2.7'
-
-gem "faker", "~> 3.4", :group => :development
From c2181a711eb3fd4ed28ad77f2c7a5da32fdde4a7 Mon Sep 17 00:00:00 2001
From: Marco
Date: Thu, 5 Sep 2024 19:27:55 -0400
Subject: [PATCH 03/13] feat: add basic recipe
---
app/models/recipe.rb | 2 ++
db/migrate/20240905222849_create_recipes.rb | 10 ++++++++++
lib/tasks/recipes.rake | 9 +++++++++
test/fixtures/recipes.yml | 9 +++++++++
test/models/recipe_test.rb | 7 +++++++
5 files changed, 37 insertions(+)
create mode 100644 app/models/recipe.rb
create mode 100644 db/migrate/20240905222849_create_recipes.rb
create mode 100644 lib/tasks/recipes.rake
create mode 100644 test/fixtures/recipes.yml
create mode 100644 test/models/recipe_test.rb
diff --git a/app/models/recipe.rb b/app/models/recipe.rb
new file mode 100644
index 0000000..69523fd
--- /dev/null
+++ b/app/models/recipe.rb
@@ -0,0 +1,2 @@
+class Recipe < ApplicationRecord
+end
diff --git a/db/migrate/20240905222849_create_recipes.rb b/db/migrate/20240905222849_create_recipes.rb
new file mode 100644
index 0000000..b599da4
--- /dev/null
+++ b/db/migrate/20240905222849_create_recipes.rb
@@ -0,0 +1,10 @@
+class CreateRecipes < ActiveRecord::Migration[7.1]
+ def change
+ create_table :recipes do |t|
+ t.string :title
+ t.text :description
+
+ t.timestamps
+ end
+ end
+end
diff --git a/lib/tasks/recipes.rake b/lib/tasks/recipes.rake
new file mode 100644
index 0000000..bae2c74
--- /dev/null
+++ b/lib/tasks/recipes.rake
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+namespace :recipes do
+ desc 'Seed recipes'
+ task seed: :environment do
+ 100.times do
+ Recipe.create!(title: Faker::Food.dish, description: Faker::Food.description)
+ end
+ end
+end
diff --git a/test/fixtures/recipes.yml b/test/fixtures/recipes.yml
new file mode 100644
index 0000000..3976eba
--- /dev/null
+++ b/test/fixtures/recipes.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ title: MyString
+ description: MyString
+
+two:
+ title: MyString
+ description: MyString
diff --git a/test/models/recipe_test.rb b/test/models/recipe_test.rb
new file mode 100644
index 0000000..3d558e3
--- /dev/null
+++ b/test/models/recipe_test.rb
@@ -0,0 +1,7 @@
+require "test_helper"
+
+class RecipeTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
From 07d22adffe617b2dfa3a90667b039838fe27bc89 Mon Sep 17 00:00:00 2001
From: Marco
Date: Thu, 5 Sep 2024 19:28:02 -0400
Subject: [PATCH 04/13] feat: add basic recipe
---
app/models/recipe.rb | 2 ++
db/migrate/20240905222849_create_recipes.rb | 2 ++
lib/tasks/recipes.rake | 1 +
test/models/recipe_test.rb | 4 +++-
4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/app/models/recipe.rb b/app/models/recipe.rb
index 69523fd..a9d4169 100644
--- a/app/models/recipe.rb
+++ b/app/models/recipe.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
class Recipe < ApplicationRecord
end
diff --git a/db/migrate/20240905222849_create_recipes.rb b/db/migrate/20240905222849_create_recipes.rb
index b599da4..3886121 100644
--- a/db/migrate/20240905222849_create_recipes.rb
+++ b/db/migrate/20240905222849_create_recipes.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateRecipes < ActiveRecord::Migration[7.1]
def change
create_table :recipes do |t|
diff --git a/lib/tasks/recipes.rake b/lib/tasks/recipes.rake
index bae2c74..635c853 100644
--- a/lib/tasks/recipes.rake
+++ b/lib/tasks/recipes.rake
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
namespace :recipes do
desc 'Seed recipes'
task seed: :environment do
diff --git a/test/models/recipe_test.rb b/test/models/recipe_test.rb
index 3d558e3..301dfa3 100644
--- a/test/models/recipe_test.rb
+++ b/test/models/recipe_test.rb
@@ -1,4 +1,6 @@
-require "test_helper"
+# frozen_string_literal: true
+
+require 'test_helper'
class RecipeTest < ActiveSupport::TestCase
# test "the truth" do
From 21447576847bbb245ffd4b094c901adffdcca29a Mon Sep 17 00:00:00 2001
From: mogagnon
Date: Thu, 5 Sep 2024 19:59:17 -0400
Subject: [PATCH 05/13] feat: update recipes.rake
---
.idea/Chef.iml | 31 +++++++++++++++++++++++++++++--
lib/tasks/recipes.rake | 1 +
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/.idea/Chef.iml b/.idea/Chef.iml
index c355f12..a97fe2d 100644
--- a/.idea/Chef.iml
+++ b/.idea/Chef.iml
@@ -404,6 +404,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -501,9 +517,19 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -581,6 +607,7 @@
+
diff --git a/lib/tasks/recipes.rake b/lib/tasks/recipes.rake
index 635c853..555e048 100644
--- a/lib/tasks/recipes.rake
+++ b/lib/tasks/recipes.rake
@@ -6,5 +6,6 @@ namespace :recipes do
100.times do
Recipe.create!(title: Faker::Food.dish, description: Faker::Food.description)
end
+ p 'Done seeding recipes'
end
end
From 2bd9cfba280f9209a769ccedde6629067cee2f9d Mon Sep 17 00:00:00 2001
From: Marco
Date: Fri, 6 Sep 2024 07:25:22 -0400
Subject: [PATCH 06/13] feat: add basic table
---
app/views/home/index.html.erb | 1 +
app/views/layouts/application.html.erb | 2 +-
app/views/recipes/index.html.erb | 24 ++++++++++++++++++++++++
app/views/shared/_header.html.erb | 2 +-
config/routes.rb | 3 +--
5 files changed, 28 insertions(+), 4 deletions(-)
create mode 100644 app/views/recipes/index.html.erb
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb
index 8be8d9c..505eb61 100644
--- a/app/views/home/index.html.erb
+++ b/app/views/home/index.html.erb
@@ -7,6 +7,7 @@
<% if user_signed_in? %>