aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-05-17 19:51:30 +0400
committerwycats <wycats@gmail.com>2010-05-17 19:51:30 +0400
commitf09d8f3e68ca7cf35a7905b00f85b84c3839c803 (patch)
treeae3e6b5da9fcdfd709214f5986fb6e28fe09aa20 /actionpack/lib
parentc3b7471c69b42132a5189013f1a8d7c7225a9127 (diff)
parentc7e6777961239224e28171a46c9768db881c5506 (diff)
downloadrails-f09d8f3e68ca7cf35a7905b00f85b84c3839c803.tar.gz
rails-f09d8f3e68ca7cf35a7905b00f85b84c3839c803.tar.bz2
rails-f09d8f3e68ca7cf35a7905b00f85b84c3839c803.zip
Merge remote branch 'origin/master'
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb5
-rw-r--r--actionpack/lib/action_view/helpers/number_helper.rb7
2 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 4b02c2deb3..8a8d21c434 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -693,6 +693,11 @@ module ActionDispatch
super
end
+ def root(options={})
+ options[:on] ||= :collection if @scope[:scope_level] == :resources
+ super(options)
+ end
+
protected
def parent_resource #:nodoc:
@scope[:scope_level_resource]
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb
index 01fecc0f23..fccf004adf 100644
--- a/actionpack/lib/action_view/helpers/number_helper.rb
+++ b/actionpack/lib/action_view/helpers/number_helper.rb
@@ -13,6 +13,9 @@ module ActionView
# unchanged if can't be converted into a valid number.
module NumberHelper
+ DEFAULT_CURRENCY_VALUES = { :format => "%u%n", :unit => "$", :separator => ".", :delimiter => ",",
+ :precision => 2, :significant => false, :strip_insignificant_zeros => false }
+
# Raised when argument +number+ param given to the helpers is invalid and
# the option :raise is set to +true+.
class InvalidNumberError < StandardError
@@ -104,9 +107,9 @@ module ActionView
defaults = I18n.translate(:'number.format', :locale => options[:locale], :default => {})
currency = I18n.translate(:'number.currency.format', :locale => options[:locale], :default => {})
- defaults = defaults.merge(currency)
- options = options.reverse_merge(defaults)
+ defaults = DEFAULT_CURRENCY_VALUES.merge(defaults).merge!(currency)
+ options = defaults.merge!(options)
unit = options.delete(:unit)
format = options.delete(:format)