Permalink
Browse files

Use merge! to merge additional options onto default options

  • Loading branch information...
1 parent dcc68fa commit a2035307130544e4d6cdbeafad0d0dd4b1beb7a6 @carlosantoniodasilva carlosantoniodasilva committed Sep 7, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 actionpack/lib/action_controller/metal/conditional_get.rb
@@ -22,7 +22,7 @@ module ClassMethods
#
# 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 @@ def fresh_when(record_or_options, additional_options = {})
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 @@ def expires_in(seconds, options = {}) #:doc:
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 ]

0 comments on commit a203530

Please sign in to comment.