From 30d9ef88c5d9eb8fa0a7796ce38e4eafe6135677 Mon Sep 17 00:00:00 2001 From: bkrigel Date: Thu, 5 Jul 2018 11:28:29 -0400 Subject: [PATCH] I had Puppy's instead of Puppy --- app.rb | 16 +++++++++++++++- models/puppy.rb | 11 +++++++++++ views/create_puppy.erb | 13 +++++++++++++ views/display_puppy.erb | 10 ++++++++++ views/index.erb | 1 + 5 files changed, 50 insertions(+), 1 deletion(-) diff --git a/app.rb b/app.rb index b1f74e9..d718574 100644 --- a/app.rb +++ b/app.rb @@ -2,4 +2,18 @@ class App < Sinatra::Base -end \ No newline at end of file + get '/' do + erb :index + end + + get '/new' do + erb :create_puppy + end + + post '/new' do + @puppy = Puppy.new(params[:name], params[:breed], params[:age]) + + erb :display_puppy + end + +end diff --git a/models/puppy.rb b/models/puppy.rb index e69de29..ebe9bc4 100644 --- a/models/puppy.rb +++ b/models/puppy.rb @@ -0,0 +1,11 @@ +class Puppy + + attr_accessor :name, :breed, :age + + def initialize(name, breed, age) + @name = name + @breed = breed + @age = age + end + +end diff --git a/views/create_puppy.erb b/views/create_puppy.erb index e69de29..82c970c 100644 --- a/views/create_puppy.erb +++ b/views/create_puppy.erb @@ -0,0 +1,13 @@ +

Create New Puppy Listing

+ +
+

Input the puppy's name: +

+

Input the puppy's breed: +

+

Input the puppy's age: +

+
+ + +
diff --git a/views/display_puppy.erb b/views/display_puppy.erb index e69de29..89c486c 100644 --- a/views/display_puppy.erb +++ b/views/display_puppy.erb @@ -0,0 +1,10 @@ +

New Puppy Listing

+ +

Puppy Name:

+

<%= @puppy.name %>

+
+

Puppy Breed:

+

<%= @puppy.breed %>

+
+

Puppy Age:

+

<%= @puppy.age %>

diff --git a/views/index.erb b/views/index.erb index e69de29..7ac71e8 100644 --- a/views/index.erb +++ b/views/index.erb @@ -0,0 +1 @@ +Click Here To List A Puppy