Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added index and show views for Guess
- Loading branch information
Showing
4 changed files
with
60 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,11 +1,22 @@ | |||
class GuessesController < ApplicationController | class GuessesController < ApplicationController | ||
|
|||
def index | |||
@guesses = Guess.all | |||
end | |||
|
|||
def new | def new | ||
@guess = Guess.new | @guess = Guess.new | ||
end | end | ||
|
|
||
def create | def create | ||
@guess = Guess.create(params[:guess]) | @guess = Guess.create(params[:guess]) | ||
redirect_to new_guess_path | redirect_to @guess | ||
end | end | ||
|
|
||
def show | |||
@guess = Guess.find(params[:id]) | |||
@pop_state = PopulationState.find(1) | |||
end | |||
|
|||
|
|||
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
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