aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/railtie.rb
diff options
context:
space:
mode:
authorgregolsen <anotheroneman@yahoo.com>2012-09-18 17:18:19 +0300
committergregolsen <anotheroneman@yahoo.com>2012-09-18 17:18:19 +0300
commitda26dfbefdccac4ab1f3195ae747685d2b11be13 (patch)
treeb70490470cd80389bdaf19ab96af2948544507a9 /activesupport/lib/active_support/railtie.rb
parent9f2d1a146c3883c2ea9d16d4fa5a7ad65ca55db8 (diff)
downloadrails-da26dfbefdccac4ab1f3195ae747685d2b11be13.tar.gz
rails-da26dfbefdccac4ab1f3195ae747685d2b11be13.tar.bz2
rails-da26dfbefdccac4ab1f3195ae747685d2b11be13.zip
Date.beginning_of_week thread local and beginning_of_week application config option added (default is Monday)
Diffstat (limited to 'activesupport/lib/active_support/railtie.rb')
-rw-r--r--activesupport/lib/active_support/railtie.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/railtie.rb b/activesupport/lib/active_support/railtie.rb
index aa8d408da9..29351db742 100644
--- a/activesupport/lib/active_support/railtie.rb
+++ b/activesupport/lib/active_support/railtie.rb
@@ -27,6 +27,15 @@ module ActiveSupport
Time.zone_default = zone_default
end
+ # Sets the default week start
+ # If assigned value is not a valid day symbol (e.g. :sunday, :monday, ...), an exception will be raised.
+ initializer "active_support.initialize_beginning_of_week" do |app|
+ require 'active_support/core_ext/date/calculations'
+ beginning_of_week_default = Date.find_beginning_of_week!(app.config.beginning_of_week)
+
+ Date.beginning_of_week_default = beginning_of_week_default
+ end
+
initializer "active_support.set_configs" do |app|
app.config.active_support.each do |k, v|
k = "#{k}="