Re: [Rails] What is the Ruby idiom for this?
On Sun, 22 Nov 2009, RVince wrote:
> I have a problem regarding an algorith, for a record I am looking for.
> I can do it in straight sql statements, but I am certain there is a
> Ruby "idion" for this (which, coming from another language, is the
> hardest thing about this fantastic language, getting a handle on the
> idiomsm the syntactic sugars).
>
> Suppose I have a table with
>
> channel_id int(11)
> associate_id int(11)
> battingorder int(11)
>
> I have an id for an associate ('my_associate_id') and I want to
> determine if my associate is in this table with a given channel_id (my
> channel_id) and if not, to select the associate_id in this list whose
> channel_id matches my_channel_id with the lowest batting order.
>
> Doing this in a couple of sql statements is quite trivial -- but is
> there a way to do it in a purely Ruby-like idiom?
You could look at Ruby DBI or maybe you can use ActiveRecord from Rails.
--
A
--
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@googlegroups.com.
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=.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home