Monday, July 18, 2011

[Rails] Railties config.time_zone

Hi,

I have stumbled upon a small issue regarding the use of Railties
(Engine) and setting the time_zone.

It seems when I set the time_zone in my engine like:

class Engine < Rails::Engine
config.time_zone = 'Brussels'
end


The actual time zone in the application is set back to the default 'UTC'
.

But if I delay setting the time zone until after initialization:

class Engine < Rails::Engine
config.after_initialize do
Rails::Application.config.time_zone = 'Brussels'
end
end

The time zone is set correctly.

On first glans, it seems that Rails doesn't take the engine setting into
account, and goes ahead using the default Rails 'UTC' setting.

I don't know if this is seen as expected behavior, but for me it seems
more logically that when you specify the time_zone setting in your
Engine, your application takes it into account. Unless of course you
overwrite it in your projects application.rb file.

Could someone elaborate on this?

Thank you in advance

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate