diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index ef9b914..c73ec9c 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -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 diff --git a/app/controllers/municipalities_controller.rb b/app/controllers/municipalities_controller.rb index 05e7744..c457ced 100644 --- a/app/controllers/municipalities_controller.rb +++ b/app/controllers/municipalities_controller.rb @@ -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 = '' diff --git a/app/views/contacts/_form.html.erb b/app/views/contacts/_form.html.erb index b9fe654..3bc4042 100644 --- a/app/views/contacts/_form.html.erb +++ b/app/views/contacts/_form.html.erb @@ -19,6 +19,19 @@ <%= f.label :birthdate %>
<%= f.datetime_select :birthdate %> + + +
+ <%= f.label :sex %>
+
+ <%= f.radio_button(:sex, "male") %> + <%= f.label(:sex_male, "male") %> + <%= f.radio_button(:sex, "female") %> + <%= f.label(:sex_female, "female") %> +
+
+ +
<%= f.label :email %>
<%= f.text_field :email %> diff --git a/app/views/contacts/index.html.erb b/app/views/contacts/index.html.erb index 137dcc7..4b42fc8 100644 --- a/app/views/contacts/index.html.erb +++ b/app/views/contacts/index.html.erb @@ -4,6 +4,7 @@ Name Birthdate + Sex Email Street number Colony @@ -18,6 +19,7 @@ <%= contact.name %> <%= contact.birthdate %> + <%= contact.sex %> <%= contact.email %> <%= contact.street_number %> <%= contact.colony %> diff --git a/app/views/contacts/show.html.erb b/app/views/contacts/show.html.erb index 4cbfeb1..e4e62ab 100644 --- a/app/views/contacts/show.html.erb +++ b/app/views/contacts/show.html.erb @@ -10,6 +10,12 @@ <%= @contact.birthdate %>

+

+ Sex: + <%= @contact.sex %> +

+ +

Email: <%= @contact.email %> diff --git a/db/migrate/20120402142512_create_contacts.rb b/db/migrate/20120402142512_create_contacts.rb index 19f6569..d451096 100644 --- a/db/migrate/20120402142512_create_contacts.rb +++ b/db/migrate/20120402142512_create_contacts.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index c22d85a..ede88c3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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"