Skip to content
This repository
Browse code

Make sure the expiry hash is built by comparing the to_param-ized val…

…ues of each hash

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6465 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 777deb9d15791e137b200e96283ff03b075fd3dc 1 parent b0685e9
Jamis Buck authored
2  actionpack/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Make sure the route expiry hash is constructed by comparing the to_param-ized values of each hash. [Jamis Buck]
  4
+
3 5
 * Allow configuration of the default action cache path for #caches_action calls.  [Rick Olson]
4 6
 
5 7
   class ListsController < ApplicationController
2  actionpack/lib/action_controller/routing.rb
@@ -1195,7 +1195,7 @@ def options_as_params(options)
1195 1195
   
1196 1196
       def build_expiry(options, recall)
1197 1197
         recall.inject({}) do |expiry, (key, recalled_value)|
1198  
-          expiry[key] = (options.key?(key) && options[key] != recalled_value)
  1198
+          expiry[key] = (options.key?(key) && options[key].to_param != recalled_value.to_param)
1199 1199
           expiry
1200 1200
         end
1201 1201
       end
9  actionpack/test/controller/routing_test.rb
@@ -1793,7 +1793,14 @@ def test_query_params_will_be_shown_when_recalled
1793 1793
       {:controller => 'post', :action => 'show', :parameter => 1}
1794 1794
     )
1795 1795
   end
1796  
-  
  1796
+
  1797
+  def test_expiry_determination_should_consider_values_with_to_param
  1798
+    set.draw { |map| map.connect 'projects/:project_id/:controller/:action' }
  1799
+    assert_equal '/projects/1/post/show', set.generate(
  1800
+      {:action => 'show', :project_id => 1},
  1801
+      {:controller => 'post', :action => 'show', :project_id => '1'})
  1802
+  end
  1803
+
1797 1804
   def test_generate_all
1798 1805
     set.draw do |map|
1799 1806
       map.connect 'show_post/:id', :controller => 'post', :action => 'show'

0 notes on commit 777deb9

Please sign in to comment.
Something went wrong with that request. Please try again.