# ActiveRecord belongs\_to ActiveResource

**URL:** <https://www.ruby-forum.com/t/activerecord-belongs-to-activeresource/165250>\
**Category:** Rails\
**Created:** [April 10, 2009, 7:37pm UTC](https://www.ruby-forum.com/t/activerecord-belongs-to-activeresource/165250 "2009-04-10T19:37:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![frogstarr78](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a5b964/32.png) [@frogstarr78](https://www.ruby-forum.com/u/frogstarr78)\
**Post date:** [April 10, 2009, 7:37pm UTC](https://www.ruby-forum.com/t/activerecord-belongs-to-activeresource/165250/1 "2009-04-10T19:37:11Z")

</div>

class Thing \< ActiveRecord::Base  
belongs\_to :other\_thing  
end

class OtherThing \< ActiveResource::Base  
self.site = …  
end

The association here works. I can access other\_thing from thing with  
no problems until, as usual, testing. Specifically functionally test  
the things\_controller. The things controller is simple scaffold,  
however, having the association to an active resource model causes  
functional tests to error because they don’t make the required request  
to the resource, dispite using the ActiveRecord::HttpMock… mechanism  
in the functional test.

So I have three questions really.  
One, is this type of relationship something that we can expect to work  
in rails? Or am I running off the rails here?  
Two, assuming that this is an acceptable use case. Using TDD, as  
apposed to BDD. Is there infrastructure already in rails for  
functionally testing this?  
Three, are there any other suggestions? (e.g. Stubbing  
@thing.other\_thing, plugins that do this, etc)
