Permalink
Browse files

merge changes

  • Loading branch information...
Felix Tsai
Felix Tsai committed Oct 5, 2012
2 parents 2a82482 + 0afe2f4 commit 02a63f57e383f817293969040a48a0f94e063cc1
View
@@ -1,6 +1,7 @@
class Guess < ActiveRecord::Base
attr_accessible :height, :weight, :name
-
+ validates :height, :numericality => { :only_integer => true }
+ validates :weight, :numericality => { :only_integer => true }
end
View
@@ -1,6 +1,8 @@
class Person < ActiveRecord::Base
attr_accessible :height, :name, :sex, :weight
+ validates :height, :numericality => { :only_integer => true }
+ validates :weight, :numericality => { :only_integer => true }
after_create :population_update
@@ -12,6 +14,6 @@ def population_update
@pop_state = PopulationState.first
if self.sex == "M"
pop_state.total_males += 1
+ end
end
-
end
@@ -3,10 +3,10 @@
= f.label :name
= f.text_field :name
.field
- = f.label :height
+ = f.label "Height in Whole Inches"
= f.number_field :height
.field
- = f.label :weight
+ = f.label "Weight in Whole pounds"
= f.number_field :weight
.actions
= f.submit 'Have Miss Cleo Guess a Gender'
@@ -14,13 +14,7 @@
<ul class="nav">
<li class="dropdown">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">
- Guess
- <b class="caret"></b>
- </a>
- <ul class="dropdown-menu">
- <li><%= link_to "People List", people_path %></li>
- </ul>
+ <%= link_to "Guess", new_guess_path %>
</li>
</ul>
</div>
@@ -10,13 +10,13 @@
= f.label :name
= f.text_field :name
.field
- = f.label :height
+ = f.label "Height in Whole Inches"
= f.number_field :height
.field
- = f.label :weight
+ = f.label "Weight in Whole pounds"
= f.number_field :weight
.field
= f.label :sex
- = f.text_field :sex
+ = f.select :sex, [['Male', "M"], ['Female', "F"]]
.actions
= f.submit 'Save'

0 comments on commit 02a63f5

Please sign in to comment.