Index: app/models/page.rb =================================================================== --- app/models/page.rb (revision 178) +++ app/models/page.rb (working copy) @@ -79,7 +79,13 @@ private def update_published_at - write_attribute('published_at', Time.now) if (status_id.to_i == Status[:published].id) and published_at.nil? + if (status_id.to_i == Status[:published].id) and published_at.nil? + t = Time.now + if ActiveRecord::Base.default_timezone == :utc + t.utc + end + write_attribute('published_at', t) + end true end @@ -88,4 +94,4 @@ true end -end \ No newline at end of file +end Index: test/unit/page_test.rb =================================================================== --- test/unit/page_test.rb (revision 178) +++ test/unit/page_test.rb (working copy) @@ -104,7 +104,11 @@ @page.status_id = status(:published).id @page.save assert_not_nil @page.published_at - assert_equal Time.now.day, @page.published_at.day + t = Time.now + if ActiveRecord::Base.default_timezone == :utc + t.utc + end + assert_equal t.day, @page.published_at.day end def test_published_at__not_updated_on_save_because_already_published