Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Guess Form

  • Loading branch information...
commit 8f41223306bdd8f1890c83b4e7605aace45eee4f 1 parent 8673688
@dladowitz dladowitz authored
View
5 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
View
6 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
View
12 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 %>
View
23 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
Please sign in to comment.
Something went wrong with that request. Please try again.