diff options
author | Bogdan Gusiev <agresso@gmail.com> | 2014-05-05 10:48:59 +0300 |
---|---|---|
committer | Bogdan Gusiev <agresso@gmail.com> | 2014-05-05 16:45:16 +0300 |
commit | 7e20bdc20dd91e1195086a5f54178a01b74ebb31 (patch) | |
tree | 2cbd6950a407332e15006e009b3fd5de36b93ce9 /activerecord/test | |
parent | f2003834c85db173ea436273b63315543b82f896 (diff) | |
download | rails-7e20bdc20dd91e1195086a5f54178a01b74ebb31.tar.gz rails-7e20bdc20dd91e1195086a5f54178a01b74ebb31.tar.bz2 rails-7e20bdc20dd91e1195086a5f54178a01b74ebb31.zip |
Put back Relation#join method as a delegate to Array
This is a regression 4.0 -> 4.1 fix.
In 4.1.0 Relation#join is delegated to Arel#SelectManager.
In 4.0 series it is delegated to Array#join
This patch puts back the behaviour of 4.0
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relation/delegation_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/models/comment.rb | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/cases/relation/delegation_test.rb b/activerecord/test/cases/relation/delegation_test.rb index 9b2bfed039..29c9d0e2af 100644 --- a/activerecord/test/cases/relation/delegation_test.rb +++ b/activerecord/test/cases/relation/delegation_test.rb @@ -32,7 +32,7 @@ module ActiveRecord :exclude?, :find_all, :flat_map, :group_by, :include?, :length, :map, :none?, :one?, :partition, :reject, :reverse, :sample, :second, :sort, :sort_by, :third, - :to_ary, :to_set, :to_xml, :to_yaml + :to_ary, :to_set, :to_xml, :to_yaml, :join ] ARRAY_DELEGATES.each do |method| diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 68e62934c1..6a880c6680 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1677,4 +1677,8 @@ class RelationTest < ActiveRecord::TestCase merged = left.merge(right) assert_equal post, merged.first end + + def test_relation_join_method + assert_equal 'Thank you for the welcome,Thank you again for the welcome', Post.first.comments.join(",") + end end diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb index ede5fbd0c6..f82df417ce 100644 --- a/activerecord/test/models/comment.rb +++ b/activerecord/test/models/comment.rb @@ -26,6 +26,10 @@ class Comment < ActiveRecord::Base all end scope :all_as_scope, -> { all } + + def to_s + body + end end class SpecialComment < Comment |