views:

31

answers:

1

Search logic is automagically doing an INNER JOIN on one the tables in my DB, is there a way to get it to specify to not include the user column in that second table?

A: 

Possibly, but that's a complicated (and therefore not the best) solution to your ambiguous column problem. The ambiguity occurs presumably because you have some conditions referrring to a column name and both tables have that column. The proper way to deal with that is to simply specify the table names in your query, like

@topics = Topic.find(:all, :include => [:posts], :conditions => ["topics.user_id <> ?", current_user.id])
Max Williams
so, posts is the other table, and it auto figures out which column to use?
DerNalia
I don't know what your other table is called, you didn't provide any details at all of your problem so i just did an example of someone doing a join and specifying the table name along with the column name to avoid an ambiguous query. If you edit your post to add your actual code i can give you some more specific advice.
Max Williams