Hi All:
I develop on several machines, most have Mysql 4.* and one has Mysql
5.0. On 4.*, the following erb for a fixture works fine:
updated_at: <%= 1.days.ago.to_s:db%>
But fails on 5.0. I had a similar deal when I had date fixtures, and
switched forrmats so that both 4.* and 5.0 were happy. is there
to_s:db_works_for_mysql_50() ? or similar?
Thanks
Forrest
Forrest C. wrote:
Hi All:
I develop on several machines, most have Mysql 4.* and one has Mysql
5.0. On 4.*, the following erb for a fixture works fine:
updated_at: <%= 1.days.ago.to_s:db%>
But fails on 5.0. I had a similar deal when I had date fixtures, and
switched forrmats so that both 4.* and 5.0 were happy. is there
to_s:db_works_for_mysql_50() ? or similar?
Thanks
Forrest
I use the following with mysql d.0 with no problems
updated_at: <%= 1.days.ago.to_formatted_s(:db) %>
They both seem to have the same format in script/console. I made the
change but still get the error below. I notice what’s being inserted
is different than what comes out of script/console
- Error:
test_pattern(PatternViewedMetricTest):
ActiveRecord::StatementInvalid: Mysql::Error: #22007Incorrect datetime
value: ‘2006-06-08T10:40:13-0700’ for column ‘updated_at’ at row 1:
INSERT INTO pattern_viewed_metrics (updated_at
, pattern_id
, id
,
person_id
) VALUES (‘2006-06-08T10:40:13-0700’, 2, 2, 1)
Any ideas?
I’m an idiot. I had one field called DateTime.now.to_formatted_s(:db)
which was the culprit.
Everything works