For example:
abc = ABC.find(:first, :conditions => "id = 1")
puts abc["date"] # 2009-06-25
#let's create a new object 'model' and set the same date as ABC
model = Model.new
model.date = abc["date"]
model.name = "a name"
model.save!
After, in Sqlserver management studio:
select * from model;
--date = 2009-06-24 15:00:00:000
--name = "a name"
So why it's not the 25th?? Is there a bad configuration somewhere? Well, I don't know. When I have more time, I'll try to understand why, but for now, to avoid this problem, I'm doing the following:
model.date = "#{abc["date"] }"
No comments:
Post a Comment