I have two tables in a database: bars and accounts. (bars isn’t what you
think, but that’s anoher story). Anyway, an accounts has_many bars and
bars belongs_to account. In my bars table their is an id and an account
column. What I am trying to do is to pull out the account variabel from
the bars database and am having some issues. I get this error:
RuntimeError: ERROR C42703 Mcolumn accounts.bar_id does not exist
Fparse_func.c L1036 Runknown_attribute: SELECT * FROM accounts WHERE
(accounts.bar_id = 150991) LIMIT 1
Odviously, it is getting confused about which table it should be looking
in, but to be honest, I’m looking at my code and it looks pretty sound
and it should work since I have written this exact code for various
things many, many times in the past. Here is the select:
<%= select( “bar”, “account”, Bar.find_by_sql( ‘SELECT * From bars where
bars.account > 0’ ).collect{ |p| [p.account, p.id] },
{include_blank => false } ) %>
Unless I am mistaken, the p in the collect is an object of bar correct?
It is here that I believe all my problems are occuring. Thanks,
-Shandy