From 67a838574be000f329c0f340474bc9cec1aeca16 Mon Sep 17 00:00:00 2001 From: Matthijs Langenberg Date: Fri, 24 Sep 2010 22:37:26 +0200 Subject: Fix broken module namespacing in ActiveResource with Ruby 1.9 [#5699 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Following namespace use case was broken with Ruby 1.9: class Author < ActiveRecord::Base ... end module Api class Book < ActiveResouce::Base end end Let's say XML contains John.... Api::Book.first.author.class.to_s #=> Ruby 1.8.7: "Api::Book::Author" (namespaced, correct), Ruby 1.9: "Author" (toplevel, broken) Signed-off-by: José Valim --- activeresource/test/cases/base_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activeresource/test/cases') diff --git a/activeresource/test/cases/base_test.rb b/activeresource/test/cases/base_test.rb index 18c732b2ab..abf4259a54 100644 --- a/activeresource/test/cases/base_test.rb +++ b/activeresource/test/cases/base_test.rb @@ -1097,4 +1097,9 @@ class BaseTest < Test::Unit::TestCase plan.save! assert_equal 10.00, plan.price end + + def test_namespacing + sound = Asset::Sound.find(1) + assert_equal "Asset::Sound::Author", sound.author.class.to_s + end end -- cgit v1.2.3