On 16 September 2011 22:01, Paul Bergstrom <[email protected]> wrote:
> A find will make an array, right? Or is it a hash? Anyway, if I have
> several records in an array/hash, how can I find e.g. record with id 10
> and it's content?

If you already have the results of a find operation, @records for
example (which is like an array with extra functionality) then to find
the record with id 10 within that by
@record10 = @records.find(10)

Similarly you can do other active record find operations involving
conditions, order and so on.

Or of course you can simply do Record.find(10) to get the original
record from the db as Tim has pointed out.

Colin

-- 
gplus.to/clanlaw

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