diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-09-07 11:17:37 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-09-07 11:18:17 -0300 |
commit | a2035307130544e4d6cdbeafad0d0dd4b1beb7a6 (patch) | |
tree | 005703a2f70e7252cb9b902bc298fe0a57e86d15 /actionpack | |
parent | dcc68fa443ab347441a4071bf2154372b08fe6c2 (diff) | |
download | rails-a2035307130544e4d6cdbeafad0d0dd4b1beb7a6.tar.gz rails-a2035307130544e4d6cdbeafad0d0dd4b1beb7a6.tar.bz2 rails-a2035307130544e4d6cdbeafad0d0dd4b1beb7a6.zip |
Use merge! to merge additional options onto default options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/metal/conditional_get.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/metal/conditional_get.rb b/actionpack/lib/action_controller/metal/conditional_get.rb index 7521deaaca..12ef68ff26 100644 --- a/actionpack/lib/action_controller/metal/conditional_get.rb +++ b/actionpack/lib/action_controller/metal/conditional_get.rb @@ -22,7 +22,7 @@ module ActionController # # class InvoicesController < ApplicationController # etag { current_user.try :id } - # + # # def show # # Etag will differ even for the same invoice when it's viewed by a different current_user # @invoice = Invoice.find(params[:id]) @@ -71,7 +71,7 @@ module ActionController options.assert_valid_keys(:etag, :last_modified, :public) else record = record_or_options - options = { etag: record, last_modified: record.try(:updated_at) }.merge(additional_options) + options = { etag: record, last_modified: record.try(:updated_at) }.merge!(additional_options) end response.etag = combine_etags(options[:etag]) if options[:etag] @@ -162,8 +162,7 @@ module ActionController def expires_now #:doc: response.cache_control.replace(:no_cache => true) end - - + private def combine_etags(etag) [ etag, *etaggers.map { |etagger| instance_exec(&etagger) }.compact ] |