# Issue with ht:t :source and foreign key

**URL:** <https://www.ruby-forum.com/t/issue-with-ht-t-source-and-foreign-key/115273>\
**Category:** Rails\
**Created:** [September 22, 2007, 11:39pm UTC](https://www.ruby-forum.com/t/issue-with-ht-t-source-and-foreign-key/115273 "2007-09-22T23:39:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koalemos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@Koalemos](https://www.ruby-forum.com/u/Koalemos)\
**Post date:** [September 22, 2007, 11:39pm UTC](https://www.ruby-forum.com/t/issue-with-ht-t-source-and-foreign-key/115273/1 "2007-09-22T23:39:15Z")

</div>

I’m having an issue when trying to use my hm:t relation. For some  
reason it’s using the wrong foreign key in some situations but not  
all. The following is the error as well as the models in question.

[http://pastie.textmate.org/99753](http://pastie.textmate.org/99753)

I realize i could probably simplify this by making the join column  
user\_id rather then earner\_id but i have a reason for this and I’m  
also learning a lot more by trying to do it this way.

Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![Koalemos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@Koalemos](https://www.ruby-forum.com/u/Koalemos)\
**Post date:** [September 23, 2007, 4:52am UTC](https://www.ruby-forum.com/t/issue-with-ht-t-source-and-foreign-key/115273/2 "2007-09-23T04:52:38Z")

</div>

Koalemos wrote:

> Thanks in advance for any help.  
> Looks like a bug:

[http://dev.rubyonrails.org/ticket/5976](http://dev.rubyonrails.org/ticket/5976)

–  
Michael W.
