aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-03-19 03:50:14 +0000
committerRick Olson <technoweenie@gmail.com>2006-03-19 03:50:14 +0000
commit891a962a192bdd7eb0402b41e11a5e5657fe961c (patch)
tree2f34ec037e56a8fa6e537adb15faafba0e5dd17d /activesupport/lib
parent9038303af0a634a3ac9ae8234d121a1815960d2e (diff)
downloadrails-891a962a192bdd7eb0402b41e11a5e5657fe961c.tar.gz
rails-891a962a192bdd7eb0402b41e11a5e5657fe961c.tar.bz2
rails-891a962a192bdd7eb0402b41e11a5e5657fe961c.zip
Added nicer message for assert_redirected_to (closes #4294) [court3nay, Chris McGrath]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3969 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/hash.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/hash/diff.rb11
2 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash.rb b/activesupport/lib/active_support/core_ext/hash.rb
index b8309baea3..7d94d70910 100644
--- a/activesupport/lib/active_support/core_ext/hash.rb
+++ b/activesupport/lib/active_support/core_ext/hash.rb
@@ -2,10 +2,12 @@ require File.dirname(__FILE__) + '/hash/keys'
require File.dirname(__FILE__) + '/hash/indifferent_access'
require File.dirname(__FILE__) + '/hash/reverse_merge'
require File.dirname(__FILE__) + '/hash/conversions'
+require File.dirname(__FILE__) + '/hash/diff'
class Hash #:nodoc:
include ActiveSupport::CoreExtensions::Hash::Keys
include ActiveSupport::CoreExtensions::Hash::IndifferentAccess
include ActiveSupport::CoreExtensions::Hash::ReverseMerge
include ActiveSupport::CoreExtensions::Hash::Conversions
+ include ActiveSupport::CoreExtensions::Hash::Diff
end
diff --git a/activesupport/lib/active_support/core_ext/hash/diff.rb b/activesupport/lib/active_support/core_ext/hash/diff.rb
new file mode 100644
index 0000000000..deace40a29
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/hash/diff.rb
@@ -0,0 +1,11 @@
+module ActiveSupport #:nodoc:
+ module CoreExtensions #:nodoc:
+ module Hash #:nodoc:
+ module Diff
+ def diff(h2)
+ self.dup.delete_if { |k, v| h2[k] == v }.merge(h2.dup.delete_if { |k, v| self.has_key?(k) })
+ end
+ end
+ end
+ end
+end