diff --git a/app.rb b/app.rb index b1f74e9..3ceba7d 100644 --- a/app.rb +++ b/app.rb @@ -2,4 +2,19 @@ class App < Sinatra::Base -end \ No newline at end of file + get '/' do + erb :index + end + + get '/new' do + erb :create_puppy + end + + post '/puppy' do + @puppy = Puppy.new(params[:name], params[:breed], params[:age]) + erb :display_puppy + end +end + + + diff --git a/config.ru b/config.ru index c356a49..1adfa7d 100644 --- a/config.ru +++ b/config.ru @@ -1,3 +1,3 @@ require './config/environment' -run App \ No newline at end of file +run App diff --git a/models/puppy.rb b/models/puppy.rb index e69de29..2b54bed 100644 --- a/models/puppy.rb +++ b/models/puppy.rb @@ -0,0 +1,9 @@ +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..f134ab5 100644 --- a/views/create_puppy.erb +++ b/views/create_puppy.erb @@ -0,0 +1,15 @@ + + +
+Puppy Name: <%= params[:name] %>
+Puppy Breed: <%= params[:breed] %>
+Puppy Age: <%= params[:age] %> months
+ + diff --git a/views/index.erb b/views/index.erb index e69de29..70ef2e1 100644 --- a/views/index.erb +++ b/views/index.erb @@ -0,0 +1,10 @@ + + + +