ActiveRecord :dependent problem


Hey guys,

I have trouble with the ActiveRecord dependent option, I guess it’s a
bug in ActiveRecord.

I have a superclass called ‘list’ which has to subclasses ‘hard_list’
and ‘intelligent_list’. I’m working with single table inheritance and it
works well. There is a table called lists, which holds information about
my lists, a table called items, which has all the list items and a table
called lists_items, which knows what item belogs to what list.

Now the problem: my intelligent_list does not have items in that
lists_item table since its items are fetched with an user-defined SQL
query. I used :finder_sql for that and it works fine. But when I want to
delete that list, ActiveRecord tries to nullify the corresponding
entries in my lists_items table. Because I have that intelligent list,
there are no items stored, but that query would not be a problem, it
would just do nothing but it doesnt work. Rails tries to find the items
in lists_items by the field intelligent_list_id since the has_many
definition is in the intelligent_list class. This behavoir is wrong
because the key is called list_id (I’m using single table inheritance),
so how can I avoid that query? How can I tell active record not to do
anything with items in that lists_items table? Or are there other

The only thing I see right now to avoid that SQL error is adding an
intelligent_list_id column, but that kinda sucks :slight_smile: