From: Jeremy McAnally Date: 2008-10-08T01:29:13+09:00 Subject: Re: RINQ? Isn't this basically what Ambition is? http://ambition.rubyforge.org/ --Jeremy On Tue, Oct 7, 2008 at 9:31 AM, Trans wrote: > > > On Oct 7, 5:11 am, Peņa, Botp wrote: >> From: Trans [mailto:transf...@gmail.com] >> #... >> # r = query do >> # from :c => :customer, :a => :account, :b => :bank >> # select b.name >> # where (( c.firstname == first1 ) | >> # ( c.firstname == first2 ) ) & >> # ( c.lastname =~ last ) & >> # ( a.owner == c ) & >> # ( a.bank == b ) >> # end >> >> try >> >> r = query(customer, account, bank) do |c,a,b| >> select (( c.firstname == first1 ) | >> ( c.firstname == first2 ) ) & >> ( c.lastname =~ last ) & >> ( a.owner == c ) & >> ( a.bank == b ) . >> collect b.name >> end > > Ah, I see. Ok, then even a little more Rubyish: > > r = select(customer, account, bank) do |c,a,b| > (( c.firstname == first1 ) || > ( c.firstname == first2 )) && > ( c.lastname =~ last ) && > ( a.owner == c ) && > ( a.bank == b ) > end. > collect(customer){ |b| b.name } > >> #... >> # But is Ruby ultimately expressive enough? We >> # may end up adding enough new syntax >> >> i think ruby syntax is more than enough (imho). In a way, i'd like to think like active records when it comes to databases (in mfowler's sense, not rails) and use ruby to implem. > > How does Fowler's approach differ from Rails? I didn't know there was > an essential distinction. > > T. > > -- http://jeremymcanally.com/ http://entp.com/ http://omgbloglol.com My books: http://manning.com/mcanally/ http://humblelittlerubybook.com/ (FREE!)