On Mon, Jan 5, 2009 at 2:13 PM, Danny Burkes <
[email protected]> wrote:

>
> Taylor Strait wrote:
> >
> >   has_many  :open_invitations,
> >             :class_name => 'Invitation',
> >             :conditions => "completed_at IS NULL AND is_closed = 'f'"
> >
> > This works for SQLite3.  But as a literal string this will fail if the
> > boolean values are different in another db system like MySQL, right?
> > How can I use a boolean in a condition that will work across all db
> > types?
>
> I have done things like http://pastie.org/353140


:conditions => ["completed_at IS NULL AND is_closed = ?", false] works
across databases when finding records. Does it work in a has_many
declaration?

has_many :open_invitations, :class_name => ..., :conditions =>
["completed_at IS NULL AND is_closed = ?", false]

Regards,
Craig

--~--~---------~--~----~------------~-------~--~----~
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