Permalink
Browse files

added index and show views for Guess

  • Loading branch information...
1 parent d03a5df commit 450bbd236db2a30eddd64e96412f24b76f00c58b @dladowitz dladowitz committed Oct 6, 2012
@@ -1,11 +1,22 @@
class GuessesController < ApplicationController
+
+ def index
+ @guesses = Guess.all
+ end
+
def new
@guess = Guess.new
end
def create
@guess = Guess.create(params[:guess])
- redirect_to new_guess_path
+ redirect_to @guess
end
+ def show
+ @guess = Guess.find(params[:id])
+ @pop_state = PopulationState.find(1)
+ end
+
+
end
@@ -0,0 +1,25 @@
+%h3 Miss Cleo's past perdictions
+
+%table.table-striped#guess_table
+ %thead
+ %tr
+ %th Name
+ %th Height
+ %th Weight
+ %th Prediction
+
+ - @guesses.each do |guess|
+ %tr
+ %td= guess.name
+ %td= guess.height
+ %td= guess.weight
+ %td= guess.sex
+ %td
+ .span.label.label-success
+ = link_to 'View', guess
+
+
+%br
+
+.span.label.label-inverse#person_button
+ = link_to 'New Guess', new_guess_path
@@ -0,0 +1,18 @@
+%p#notice= notice
+
+%p
+ %b Name:
+ = @guess.name
+%p
+ %b Height:
+ = @guess.height
+%p
+ %b Weight:
+ = @guess.weight
+%p
+ %b Miss Cleo thinks this person is a:
+ = @pop_state.guess
+
+
+
+= link_to 'Back', new_guess_path
@@ -13,8 +13,11 @@
<%= link_to "Miss Cleo", root_path, class: 'brand' %>
<ul class="nav">
- <li class="dropdown">
- <%= link_to "Guess", new_guess_path %>
+ <li>
+ <%= link_to "New Guess", new_guess_path %>
+ </li>
+ <li >
+ <%= link_to "Past Guesses", guesses_path %>
</li>
</ul>
</div>

0 comments on commit 450bbd2

Please sign in to comment.