When you make a find with 'include' you are using two tables in a SQL query,
so you need to explicitly write the table_name.row_name when using
conditions.

user is not the table, that's why user.cuid didn't work. users is the table
name.

Remember:

Model == Singular
table == plural

On Tue, Sep 23, 2008 at 11:29 AM, Frederick Cheung <
[EMAIL PROTECTED]> wrote:

>
>
> On 23 Sep 2008, at 17:10, Daniel Berger wrote:
> >
> > # This does not with AR 2.1.1 => PGError: ERROR:  column "cuid" does
> > not exist
> > s = Schedule.find(
> >   :first,
> >   :include    => [:user],
> >   :conditions => ["cuid = ?", "foo"] # Also tried user.cuid
> > )
> >
> > What obvious bit am I missing?
> >
> You need to qualify that column name (ie users.cuid)
>
> Fred
> > Thanks,
> >
> > Dan
> > >
>
>
> >
>


-- 
ANDRES RODRIGUEZ E
Electronic Engineer
Software Developer
IT Consultant

US Phone: (305) 853-8356
Primary Mobile: +57-300-2006186
Secondary Mobile: +57-314-7939859

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to