Is you question about where those methods should go? They can, and
usually should, go in the model.
class Product
def self.find_all
find(:all, .....)
end
def self.select_fruits(parameters)
find(:all, :conditions...
end
end
--- controller --
fruits = Product.select_fruits(:fruit_type = params[:....])
--
def gw
acts_as_n00b
writes_at(www.railsdev.ws)
end
Thank you for your answer but my question is how to add method to an
array of @products.
I have : @ products.find(:all)
module Foo
def select_fruits
# some code here
end
end
# meanwhile.. back on the farm..
@products = Product.find(:all)
@products.extend Foo
=================== Or even better.. =========================
class Product
belongs_to :fruit, :extends => Foo
end
Look for "Association extensions" within the Rails api..
hth..
ilan
--
Posted via http://www.ruby-forum.com/.