views:

29

answers:

1

Hi all,

I followed a few rails tutorials online, and it seems that to capture a date, I'd use date_select helper. But for some reason or another all the other data is captured in the database (SQLite3) except for the birthday. Any idea what I'm doing wrong?

Here's the code for the form in my view:

  <% form_for :user, :url => {:controller=>'users', :action=> "signup_student"} do |f| %>
    <div>
      <%= f.label :last_name, "Last Name" %><br />
      <%= f.text_field :last_name, :size => 40 %>
    </div>
    <div>
      <%= f.label :birthday, "Birthday" %>
      <%= f.date_select :birthday%>
    </div>
  <% end %>

Any ideas would be awesome. Thanks.

A: 

first make sure you database type is a datetime or just change it with:

change_column :user, :birthday, :datetime

and then try datetime_select instead of datetime

   <%= f.datetime_select :birthday%>
Sam