diff options
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/caching.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_controller/filters.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/resources.rb | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index 75aa9df812..1b35cbe403 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -222,7 +222,7 @@ module ActionController #:nodoc: class ActionCacheFilter #:nodoc: def initialize(*actions, &block) - @options = actions.last.is_a?(Hash) ? actions.pop : {} + @options = actions.extract_options! @actions = Set.new actions end @@ -596,7 +596,7 @@ module ActionController #:nodoc: module ClassMethods #:nodoc: def cache_sweeper(*sweepers) return unless perform_caching - configuration = sweepers.last.is_a?(Hash) ? sweepers.pop : {} + configuration = sweepers.extract_options! sweepers.each do |sweeper| ActiveRecord::Base.observers << sweeper if defined?(ActiveRecord) and defined?(ActiveRecord::Base) sweeper_instance = Object.const_get(Inflector.classify(sweeper)).instance diff --git a/actionpack/lib/action_controller/filters.rb b/actionpack/lib/action_controller/filters.rb index c2f2c2a432..ec3f5096e3 100644 --- a/actionpack/lib/action_controller/filters.rb +++ b/actionpack/lib/action_controller/filters.rb @@ -601,7 +601,7 @@ module ActionController #:nodoc: def extract_conditions(*filters, &block) #:nodoc: filters.flatten! - conditions = filters.last.is_a?(Hash) ? filters.pop : {} + conditions = filters.extract_options! filters << block if block_given? return filters, conditions end diff --git a/actionpack/lib/action_controller/resources.rb b/actionpack/lib/action_controller/resources.rb index 1cfb7c11d0..3cb9367fc2 100644 --- a/actionpack/lib/action_controller/resources.rb +++ b/actionpack/lib/action_controller/resources.rb @@ -295,7 +295,7 @@ module ActionController # HTTP POST on <tt>new_message_url</tt> will raise a RoutingError exception. The default route in # <tt>config/routes.rb</tt> overrides this and allows invalid HTTP methods for resource routes. def resources(*entities, &block) - options = entities.last.is_a?(Hash) ? entities.pop : { } + options = entities.extract_options! entities.each { |entity| map_resource(entity, options.dup, &block) } end @@ -369,7 +369,7 @@ module ActionController # edit_account edit_account_url, hash_for_edit_account_url, # edit_account_path, hash_for_edit_account_path def resource(*entities, &block) - options = entities.last.is_a?(Hash) ? entities.pop : { } + options = entities.extract_options! entities.each { |entity| map_singleton_resource(entity, options.dup, &block) } end |