Hi guys, I''m having problems with my app. First of all, I created a date_select with the code: <%= date_select(''contact'', ''birthday'', :order => [''day'',''month'',''year'']) %> In the contacts table, I create a date field: birthday DATE When I save the values goes wrong into the database. From the log: INSERT INTO contacts ("name", "nickname", "home_page", "mobile", "birthday", "phone", "user_id", "address", "email") VALUES(''test'', ''test'', ''test'', 12345, ''0010-01-01'', 12345, 2, ''test'', ''test@test.com''); I already put the following code in my environment.rb. ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!( :default => ''%m/%d/%Y'', :date_time12 => "%m/%d/%Y %I:%M%p", :date_time24 => "%m/%d/%Y %H:%M", ) And the date are still displayed as year, month, day. How can I change this behavior? Thanks in advance. Fernando Lujan
Fernando Lujan wrote:> Hi guys, > > I''m having problems with my app. First of all, I created a date_select > with the code: > > <%= date_select(''contact'', ''birthday'', :order => > [''day'',''month'',''year'']) %> > > In the contacts table, I create a date field: > > birthday DATEThe type DATE doesn''t work well with rails. I change the type to timestamp and it worked in the view. Even changing the type of the column, I still have problems recording its values . Just if I put the date_select in the format: <%= date_select(''contact'', ''birthday'', :order => [''year'',''month'',''day''] It works... How can I change this to work accordingly with my app? Thanks, Fernando Lujan
Fernando Lujan wrote:> The type DATE doesn''t work well with rails. I change the type to > timestamp and it worked in the view. Even changing the type of the > column, I still have problems recording its values . > > Just if I put the date_select in the format: > > <%= date_select(''contact'', ''birthday'', :order => [''year'',''month'',''day''] > > It DOES NOT works...Fernando Lujan