:include confused by true?

I have two models:

guest
rsvp

guest belongs_to rsvp and rsvp has_one guest

When I try the following I get an error:

@coming = Guest.find(:all, :conditions => [“coming = ?”,
true], :include => :rsvp)

It complains of an unknown column ‘coming’

I’m sure I’m doing something stupid but I can’t see it. Any help
would be appreciated.

On Aug 20, 3:01 pm, Glen [email protected] wrote:

true], :include => :rsvp)

It complains of an unknown column ‘coming’

I’m sure I’m doing something stupid but I can’t see it. Any help
would be appreciated.

I should mention rsvp only has two columns:

guest_id
coming

On Aug 20, 2008, at 5:05 PM, Glen wrote:

@coming = Guest.find(:all, :conditions => [“coming = ?”,
coming
:conditions => [“rsvps.coming = ?”, true]

Otherwise, AR gets confused I think. The SQL might be valid.

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

Glen wrote:

On Aug 20, 3:01�pm, Glen [email protected] wrote:

true], :include => :rsvp)

It complains of an unknown column ‘coming’

I’m sure I’m doing something stupid but I can’t see it. �Any help
would be appreciated.

I should mention rsvp only has two columns:

guest_id
coming

So is the name of the table ‘rsvp’ or ‘Guest’? It looks like you are
looking at the ‘Guest’ table for a column named ‘coming’ according to
your find statement.

On Aug 20, 3:37 pm, Rob B. [email protected]
wrote:

guest belongs_to rsvp and rsvp has_one guest

Rob B. http://agileconsultingllc.com
[email protected]

Thanks Rob,

That did the trick, knew I was doing something lame!

On Aug 20, 3:35 pm, Shandy N. [email protected]
wrote:

guest_id
coming

So is the name of the table ‘rsvp’ or ‘Guest’? It looks like you are
looking at the ‘Guest’ table for a column named ‘coming’ according to
your find statement.

Posted viahttp://www.ruby-forum.com/.

Well there are two separate tables guest and rsvp that are
associated. I want the guests who have rsvp entries of true. So I
wanted to include the rsvp table and look at the coming column there.

I’ve done similar before with a course table and a department table
where I did a find on the name of the dept. Did I just get really
lucky there and find an odd bug?

On Aug 20, 4:52 pm, Frederick C. [email protected]
wrote:

I’ve done similar before with a course table and a department table
where I did a find on the name of the dept. Did I just get really
lucky there and find an odd bug?

Well you’ve got your answer, but just to get things straight you used
to (before rails 2.1) be able to get away with not fully qualifying
the column name which is probably why you remember this working.

Fred

Thanks Fred,

That does explain things, my own laziness in the past did me in.

On Aug 20, 10:39 pm, Glen [email protected] wrote:

On Aug 20, 3:35 pm, Shandy N. [email protected]
wrote:

com/.

Well there are two separate tables guest and rsvp that are
associated. I want the guests who have rsvp entries of true. So I
wanted to include the rsvp table and look at the coming column there.

I’ve done similar before with a course table and a department table
where I did a find on the name of the dept. Did I just get really
lucky there and find an odd bug?

Well you’ve got your answer, but just to get things straight you used
to (before rails 2.1) be able to get away with not fully qualifying
the column name which is probably why you remember this working.

Fred