Skip to content

Commit

Permalink
Added Guess Form
Browse files Browse the repository at this point in the history
  • Loading branch information
dladowitz committed Oct 5, 2012
1 parent 8673688 commit 8f41223
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
5 changes: 2 additions & 3 deletions app/controllers/guesses_controller.rb
@@ -1,11 +1,10 @@
class GuessesController < ApplicationController
def new

@guess = Guess.new
end

def create
@height = params[:height]
@weight = params[:weight]
@guess = Guess.create(params[:guess])
redirect_to new_guess_path
end

Expand Down
6 changes: 1 addition & 5 deletions app/models/guess.rb
@@ -1,10 +1,6 @@
class Guess < ActiveRecord::Base
attr_accessible :total_female_height, :total_female_weight, :total_male_height, :total_male_weight
attr_accessible :height, :weight, :name


end

<<<<<<< HEAD
=======
#
>>>>>>> a8bee1229962ed42dd89ca41a343dbf365cee47b
12 changes: 12 additions & 0 deletions app/views/guesses/new.html.erb.old
@@ -0,0 +1,12 @@
<%= form_for @guess do |f| %>
<%= f.label :name %>
<%= f.text_field :name %><br />

<%= f.label :height %>
<%= f.text_field :height %><br />

<%= f.label :weight %>
<%= f.text_field :weight %><br />

<%= f.submit %>
<% end %>
23 changes: 12 additions & 11 deletions app/views/guesses/new.html.haml
@@ -1,11 +1,12 @@
%h Gender Guess

= form_tag guesses_path do
=label_tag 'height (inches)'
=text_field_tag 'height'

=label_tag 'weight (lbs)'
=text_field_tag 'weight'

= submit_tag 'Save'
end
= form_for @guess do |f|
.field
= f.label :name
= f.text_field :name
.field
= f.label :height
= f.number_field :height
.field
= f.label :weight
= f.number_field :weight
.actions
= f.submit

0 comments on commit 8f41223

Please sign in to comment.