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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 20, 3:01 pm, Glen <DamnBig...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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.I should mention rsvp only has two columns: guest_id coming --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Glen wrote:> On Aug 20, 3:01�pm, Glen <DamnBig...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 > comingSo 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 via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 20, 2008, at 5:05 PM, Glen wrote:> On Aug 20, 3:01 pm, Glen <DamnBig...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> 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. > > I should mention rsvp only has two columns: > > guest_id > coming:conditions => ["rsvps.coming = ?", true] Otherwise, AR gets confused I think. The SQL might be valid. -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 20, 3:35 pm, Shandy Nantz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Glen wrote: > > On Aug 20, 3:01 pm, Glen <DamnBig...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. > -- > 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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 20, 3:37 pm, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> wrote:> On Aug 20, 2008, at 5:05 PM, Glen wrote: > > > > > On Aug 20, 3:01 pm, Glen <DamnBig...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> 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. > > > I should mention rsvp only has two columns: > > > guest_id > > coming > > :conditions => ["rsvps.coming = ?", true] > > Otherwise, AR gets confused I think. The SQL might be valid. > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.orgThanks Rob, That did the trick, knew I was doing something lame! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 20, 10:39 pm, Glen <DamnBig...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Aug 20, 3:35 pm, Shandy Nantz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 20, 4:52 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Aug 20, 10:39 pm, Glen <DamnBig...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On Aug 20, 3:35 pm, Shandy Nantz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > 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. > > FredThanks Fred, That does explain things, my own laziness in the past did me in. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---