I will have roughly 37 models that will contain this piece of code
(although it will be further modified):
def self.search(search, page)
start_date = Time.now.beginning_of_week
end_date = Time.now.end_of_week
paginate :per_page => 10, :page => page,
:conditions => [''compiled_on > ? and compiled_on <
?'', start_date,
end_date],
:conditions => [''name like ?'',
"%#{search}%"],
:order => ''rank''
end
It defines pagination using will_paginate.
The question I have is how can I simplify this by creating a
global/helper class that can be used in the other 37 pages. I''m still
very newbish but I''m really trying to learn best practice concepts so
my
cleanup process is DRY as I develop.
Many thanks..
--
Posted via http://www.ruby-forum.com/.