Skip to content

Commit

Permalink
se crearon radio button para elegir el sexo
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeVajrapani committed Apr 2, 2012
1 parent 3b99646 commit 8eb8fa8
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/contacts_controller.rb
Expand Up @@ -26,7 +26,7 @@ def show
def new
@contact = Contact.new
@states = State.order('name').all
@municipalities = Municipality.order('name').all
@municipalities = Municipality.order('name').all

respond_to do |format|
format.html # new.html.erb
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/municipalities_controller.rb
Expand Up @@ -5,7 +5,7 @@ def index
@municipalities = Municipality.all

respond_to do |format|
format.js {
format.js { # se agrego
municipalities = State.find(params[:state_id]).municipalities

@municipalities = ''
Expand Down
13 changes: 13 additions & 0 deletions app/views/contacts/_form.html.erb
Expand Up @@ -19,6 +19,19 @@
<%= f.label :birthdate %><br />
<%= f.datetime_select :birthdate %>
</div>


<div class="field">
<%= f.label :sex %><br />
<div>
<%= f.radio_button(:sex, "male") %>
<%= f.label(:sex_male, "male") %>
<%= f.radio_button(:sex, "female") %>
<%= f.label(:sex_female, "female") %>
</div>
</div>


<div class="field">
<%= f.label :email %><br />
<%= f.text_field :email %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/contacts/index.html.erb
Expand Up @@ -4,6 +4,7 @@
<tr>
<th>Name</th>
<th>Birthdate</th>
<th>Sex</th>
<th>Email</th>
<th>Street number</th>
<th>Colony</th>
Expand All @@ -18,6 +19,7 @@
<tr>
<td><%= contact.name %></td>
<td><%= contact.birthdate %></td>
<td><%= contact.sex %></td>
<td><%= contact.email %></td>
<td><%= contact.street_number %></td>
<td><%= contact.colony %></td>
Expand Down
6 changes: 6 additions & 0 deletions app/views/contacts/show.html.erb
Expand Up @@ -10,6 +10,12 @@
<%= @contact.birthdate %>
</p>

<p>
<b>Sex:</b>
<%= @contact.sex %>
</p>


<p>
<b>Email:</b>
<%= @contact.email %>
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20120402142512_create_contacts.rb
Expand Up @@ -3,6 +3,7 @@ def self.up
create_table :contacts do |t|
t.string :name
t.datetime :birthdate
t.string :sex
t.string :email
t.string :street_number
t.string :colony
Expand Down
1 change: 1 addition & 0 deletions db/schema.rb
Expand Up @@ -15,6 +15,7 @@
create_table "contacts", :force => true do |t|
t.string "name"
t.datetime "birthdate"
t.string "sex"
t.string "email"
t.string "street_number"
t.string "colony"
Expand Down

0 comments on commit 8eb8fa8

Please sign in to comment.