# Association Methods Not Working - No SQL!

**URL:** <https://discuss.rubyonrails.org/t/association-methods-not-working-no-sql/10268>\
**Category:** rubyonrails-talk\
**Created:** [March 15, 2007, 12:56am UTC](https://discuss.rubyonrails.org/t/association-methods-not-working-no-sql/10268 "2007-03-15T00:56:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![HH11](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HH11](https://discuss.rubyonrails.org/u/HH11)\
**Post date:** [March 15, 2007, 12:56am UTC](https://discuss.rubyonrails.org/t/association-methods-not-working-no-sql/10268/1 "2007-03-15T00:56:00Z")

</div>

Hey All,

I have some associations that seem to be messed up as their methods (i.e. clear, delete) don't do anything - no errors, no SQL, nothing!

It's a polymorphic has\_many :through. Here goes:

class Connection \< ActiveRecord::Base &nbsp;&nbsp;&nbsp;belongs\_to :idea &nbsp;&nbsp;&nbsp;belongs\_to :connectable, :polymorphic =\> :true end

class NewsItem \< ActiveRecord::Base &nbsp;&nbsp;&nbsp;has\_many :connections, :as =\> :connectable, :dependent =\> :destroy &nbsp;&nbsp;&nbsp;has\_many :ideas, :through =\> :connections end

class Idea \< ActiveRecord::Base &nbsp;&nbsp;&nbsp;has\_many :connections &nbsp;&nbsp;&nbsp;has\_many :news\_items, :through =\> :connections end

Let's say I do this:

\>\> news\_item.ideas \<\< ideas =\> [#\<Idea:0x34e5900 @attributes={"name"=\>"Test Idea", "short\_description"=\>"Yodel", "id"=\>"10", "long\_description"=\>"Homey"} \>, #\<Idea:0x34e58b0 @attributes={"name"=\>"Hunter's Other Idea", "short\_description"=\>"I had two ideas.", "id"=\>"12", "long\_description"=\>"Yes, I did."}\>] \>\> news\_item.ideas.size =\> 2

Great so far. The records are created, everything works. The problem is that .replace and .clear both do NOTHING:

\>\> news\_item.ideas.clear =\>

Okay, that looks right but there was no SQL generated for that so...

\>\> news\_item.reload \>\> news\_item.ideas.size =\> 2

?!?!?! I've tried this a million ways and I can't figure this out. Are the relationships specified incorrectly? Like I said, adding items and viewing them works fine. It's just anything that requires the connections between news items and ideas to be deleted that fails - but there are never any error messages, just a silent failure w/ no SQL generated.

This is on Rails 1.2.3 / Ruby 1.8.5 on OS X Tiger 10.4.9.

Any help would be very, very much appreciated.

Thanks, Hunter
