rails/rails — Issue #5189: ActiveRecord .utc/.localtime methods are confusing
Author: denispeplin
Created: 2012-02-27 07:38:52+00:00
State: open

I have legacy postgresql database, and following settings in config/application.rb:

```ruby
config.time_zone = 'Volgograd'
config.active_record.default_timezone ='GMT-04:00'
```

In rails console:

```ruby
$ rails c
Loading development environment (Rails 3.2.1)

irb(main):001:0> Application.where(contract_id: 287572).first
=> #
```

That's ok.

```ruby
irb(main):002:0> Application.where(contract_id: 287572).first.created_at
=> Fri, 30 Dec 2011 13:27:23 MSK +04:00
```

That's not ok, and this is what I actually see in the view.

```ruby
irb(main):003:0> Application.where(contract_id: 287572).first.created_at.localtime
=> 2011-12-30 13:27:23 +0400

irb(main):004:0> Application.where(contract_id: 287572).first.created_at.utc
=> Fri, 30 Dec 2011 09:27:23 +0000
```

I expect, that .localtime method should return 09:27:23, but it is .utc which returns correct value for me.

And I can't use just created_at without any additional methods in my view. In views, it is almost ok, but it is the real trouble when ActiveAdmin is used.