# :include confused by true?

**URL:** <https://www.ruby-forum.com/t/include-confused-by-true/146425>\
**Category:** Rails\
**Created:** [August 20, 2008, 11:02pm UTC](https://www.ruby-forum.com/t/include-confused-by-true/146425 "2008-08-20T23:02:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 20, 2008, 11:02pm UTC](https://www.ruby-forum.com/t/include-confused-by-true/146425/1 "2008-08-20T23:02:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 20, 2008, 11:05pm UTC](https://www.ruby-forum.com/t/include-confused-by-true/146425/2 "2008-08-20T23:05:43Z")

</div>

On Aug 20, 3:01 pm, Glen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 20, 2008, 11:39pm UTC](https://www.ruby-forum.com/t/include-confused-by-true/146425/3 "2008-08-20T23:39:07Z")

</div>

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](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 20, 2008, 11:35pm UTC](https://www.ruby-forum.com/t/include-confused-by-true/146425/4 "2008-08-20T23:35:11Z")

</div>

Glen wrote:

> On Aug 20, 3:01ï¿½pm, Glen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 20, 2008, 11:46pm UTC](https://www.ruby-forum.com/t/include-confused-by-true/146425/5 "2008-08-20T23:46:44Z")

</div>

On Aug 20, 3:37 pm, Rob B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > guest belongs\_to rsvp and rsvp has\_one guest
> 
> Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
> removed\_email\_address@domain.invalid

Thanks Rob,

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

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 20, 2008, 11:40pm UTC](https://www.ruby-forum.com/t/include-confused-by-true/146425/6 "2008-08-20T23:40:53Z")

</div>

On Aug 20, 3:35 pm, Shandy N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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?

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 21, 2008, 3:43pm UTC](https://www.ruby-forum.com/t/include-confused-by-true/146425/7 "2008-08-21T15:43:38Z")

</div>

On Aug 20, 4:52 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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.

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 21, 2008, 12:52am UTC](https://www.ruby-forum.com/t/include-confused-by-true/146425/8 "2008-08-21T00:52:51Z")

</div>

On Aug 20, 10:39 pm, Glen [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Aug 20, 3:35 pm, Shandy N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> 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
