ActiveRecord model doesn't show timestamps
All ActiveRecord models in my Rails app recently showed a strange behavior relating to timestamps: The can be saved in the database (sqlite3 for development), but a loaded model only has 'nil' fields.
SQL (0.5ms) UPDATE "users" SET "confirmed_at" = ?, "updated_at" = ?, "user_type_id" = ? WHERE "users"."id" = 1 [["confirmed_at", "2014-06-07 13:50:27.437678"], ["updated_at", "2014-06-07 13:50:35.680003"], ["user_type_id", 1]]
=> #<User id: 1 ... created_at: nil, updated_at: nil ... confirmed_at: nil, ...>
When directly accessing the database, I can see all timestamps in the 'saving'-format. Any suggestions?
This behavior appears because of some settings I made at the very beginning. In application.rb I set the following:
config.time_zone = 'Berlin' config.active_record.default_timezone = 'Berlin'
This causes a loading error as active_record.default_timezone can't be set like the application's time_zone. To prevent this, I updated my code:
config.time_zone = 'Berlin' config.active_record.default_timezone = :local config.active_record.time_zone_aware_attributes = false