aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_view/path_set.rb4
-rw-r--r--activerecord/test/cases/associations/extension_test.rb8
-rw-r--r--activerecord/test/cases/base_test.rb11
3 files changed, 18 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/path_set.rb b/actionpack/lib/action_view/path_set.rb
index 21dc5617ad..bbb1af8154 100644
--- a/actionpack/lib/action_view/path_set.rb
+++ b/actionpack/lib/action_view/path_set.rb
@@ -14,6 +14,10 @@ module ActionView #:nodoc:
self
end
+ def [](i)
+ paths[i]
+ end
+
def to_ary
paths.dup
end
diff --git a/activerecord/test/cases/associations/extension_test.rb b/activerecord/test/cases/associations/extension_test.rb
index 24830a661a..490fc5177e 100644
--- a/activerecord/test/cases/associations/extension_test.rb
+++ b/activerecord/test/cases/associations/extension_test.rb
@@ -39,7 +39,9 @@ class AssociationsExtensionsTest < ActiveRecord::TestCase
david = developers(:david)
assert_equal projects(:action_controller), david.projects.find_most_recent
- david = Marshal.load(Marshal.dump(david))
+ marshalled = Marshal.dump(david)
+ david = Marshal.load(marshalled)
+
assert_equal projects(:action_controller), david.projects.find_most_recent
end
@@ -47,7 +49,9 @@ class AssociationsExtensionsTest < ActiveRecord::TestCase
david = developers(:david)
assert_equal projects(:action_controller), david.projects_extended_by_name.find_most_recent
- david = Marshal.load(Marshal.dump(david))
+ marshalled = Marshal.dump(david)
+ david = Marshal.load(marshalled)
+
assert_equal projects(:action_controller), david.projects_extended_by_name.find_most_recent
end
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index c78d887ed7..b8ebabfe70 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -1808,20 +1808,25 @@ class BasicsTest < ActiveRecord::TestCase
def test_marshal_round_trip
expected = posts(:welcome)
- actual = Marshal.load(Marshal.dump(expected))
+ marshalled = Marshal.dump(expected)
+ actual = Marshal.load(marshalled)
assert_equal expected.attributes, actual.attributes
end
def test_marshal_new_record_round_trip
- post = Marshal.load(Marshal.dump(Post.new))
+ marshalled = Marshal.dump(Post.new)
+ post = Marshal.load(marshalled)
+
assert post.new_record?, "should be a new record"
end
def test_marshalling_with_associations
post = Post.new
post.comments.build
- post = Marshal.load(Marshal.dump(post))
+
+ marshalled = Marshal.dump(post)
+ post = Marshal.load(marshalled)
assert_equal 1, post.comments.length
end