aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-12-04 15:21:47 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-12-04 15:21:47 -0200
commitdfa45ce7e1a3b0974cf6d5c3524483175faabf27 (patch)
tree9161f407b803d068bcbcfe97be0ab3d32f4a2197
parent54bccc491589e838a83a08335063e811dffc77c7 (diff)
parentf7dbf388bd867cba7a66abf44affb09960ccb4c1 (diff)
downloadrails-dfa45ce7e1a3b0974cf6d5c3524483175faabf27.tar.gz
rails-dfa45ce7e1a3b0974cf6d5c3524483175faabf27.tar.bz2
rails-dfa45ce7e1a3b0974cf6d5c3524483175faabf27.zip
Merge pull request #17792 from rockrep/master
allow 'all' for :domain option in addition to :all
-rw-r--r--actionpack/lib/action_dispatch/middleware/cookies.rb2
-rw-r--r--actionpack/test/dispatch/cookies_test.rb10
2 files changed, 11 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb
index c9fff081d6..8ec05dee70 100644
--- a/actionpack/lib/action_dispatch/middleware/cookies.rb
+++ b/actionpack/lib/action_dispatch/middleware/cookies.rb
@@ -283,7 +283,7 @@ module ActionDispatch
def handle_options(options) #:nodoc:
options[:path] ||= "/"
- if options[:domain] == :all
+ if options[:domain].respond_to?(:to_sym) && options[:domain].to_sym == :all
# if there is a provided tld length then we use it otherwise default domain regexp
domain_regexp = options[:tld_length] ? /([^.]+\.?){#{options[:tld_length]}}$/ : DOMAIN_REGEXP
diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb
index 9384c09454..19a98a4054 100644
--- a/actionpack/test/dispatch/cookies_test.rb
+++ b/actionpack/test/dispatch/cookies_test.rb
@@ -145,11 +145,21 @@ class CookiesTest < ActionController::TestCase
head :ok
end
+ def set_cookie_with_domain_all_as_string
+ cookies[:user_name] = {:value => "rizwanreza", :domain => 'all'}
+ head :ok
+ end
+
def delete_cookie_with_domain
cookies.delete(:user_name, :domain => :all)
head :ok
end
+ def delete_cookie_with_domain_all_as_string
+ cookies.delete(:user_name, :domain => 'all')
+ head :ok
+ end
+
def set_cookie_with_domain_and_tld
cookies[:user_name] = {:value => "rizwanreza", :domain => :all, :tld_length => 2}
head :ok