Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Ingredient model to demonstrate deployment of update
This commit adds an additional model to the application for the purpose of showing how we would go about deploying an application update to our app that is running in a Kubernetes cluster. We address the application update portion and also the database migration portion.
- Loading branch information
1 parent
8da6c25
commit 4c29504
Showing
10 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class Ingredient < ApplicationRecord | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
<h1>Welcome</h1> | ||
|
||
<p>Existing Recipes: <%= Recipe.count %></p> | ||
<p>Unique Ingredients: <%= Ingredient.count %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class CreateIngredients < ActiveRecord::Migration[5.0] | ||
def up | ||
create_table :ingredients do |t| | ||
t.string :name | ||
|
||
t.timestamps | ||
end | ||
|
||
Ingredient.create(name: "Olives") | ||
Ingredient.create(name: "lettuce") | ||
Ingredient.create(name: "Thyme") | ||
end | ||
|
||
def down | ||
drop_table :ingredients | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FactoryGirl.define do | ||
factory :ingredient do | ||
name "MyString" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require "test_helper" | ||
|
||
describe Ingredient do | ||
let(:ingredient) { Ingredient.new } | ||
|
||
it "must be valid" do | ||
value(ingredient).must_be :valid? | ||
end | ||
end |