IRC log for 2008-01-13

0 views
Skip to first unread message

David Leal

unread,
Jan 13, 2008, 7:05:01 PM1/13/08
to datam...@googlegroups.com
--- Log opened Sun Jan 13 16:52:32 2008
18:50 < b3b0p> how do you do something like find(:first, :conditions => ["username = :login OR email = :login", { :login => login }]) in datamapper?
18:59 < QaDeS> good question
19:06 < QaDeS> doesn't it work like that? datamapper should be query compatible to SR
19:06 < QaDeS> AR*
19:09 < lanaer> it should be possible to do it that way.
19:09 < lanaer> though more DM-ish would be: Model.first(:conditions => [...])
19:12 < QaDeS> would something like first([:username => login, :email => login]) work, too?
19:13 < QaDeS> i mean, putting the OR conditions into another map?
19:13 < QaDeS> uh, now i outed myself as a ruby n00b, right? ^^
19:13 < nagash> I don't think it supports the named placeholders
19:13 < nagash> User.first(:conditions => [ 'username = ? OR email = ?', login, login ]) will work
19:14 < QaDeS> datamapper does? zoo = Zoo.first(:name => 'Luke') <-- from the examples
19:14 < nagash> yeh
19:14 < nagash> but you can't use OR with that, which is what he asked :)
19:17 < QaDeS> yeh, that's what i meant with nested maps ;)
19:19 < QaDeS> like User.first({:user => login, :email => login}, :password => password)
19:19 < QaDeS> know what i mean?
19:19 < nagash> mm nope
19:24 < QaDeS> would translate to "user='...' OR email='...' AND password='...'"
19:30 < QaDeS> anyway, i guess i'm still too blown away from the possoibilities of ruby ;)
22:16 < djanowski> guys, i'm trying to use datamapper with sqlite
22:17 < djanowski> (anyone around?)
--- Log closed Mon Jan 14 00:00:22 2008
Reply all
Reply to author
Forward
0 new messages