Searching a database

If I have a list of items, how can I search some item in the list, by
some criteria or something else?

What class is this list you are refering to? If it is a result set
from a ActiveRecord find call try this:

jobs = Job.find :all
big_jobs = jobs.find{|job| job.total_sale > 100000 }

Hope this helps,
Zack


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Zack C. wrote:

What class is this list you are refering to? If it is a result set
from a ActiveRecord find call try this:

jobs = Job.find :all
big_jobs = jobs.find{|job| job.total_sale > 100000 }

Hope this helps,
Zack

Well, since it will be my first comercial app using rails, I will go
slow, so i’ll keep it ActiveRecord.

heri rakotomalala wrote:

ins’it too ambitious to build a commercial app if you don’t even know
how to
find an item?

Yes I agree, but we will go slow, first build something that I can use
internally at the office, like some kind of blog and/or wiki and then go
for the top of the pyramid, when I have a solid ground.

ins’it too ambitious to build a commercial app if you don’t even know
how to
find an item?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs