Marnen, good advice.
Something like this:
def self.do_sort(sort_by, search, page)
start_date = Time.now.beginning_of_week
end_date = Time.now.end_of_week
page_returns = {:conditions => ['compiled_on > ? and compiled_on <
?', start_date, end_date],
:conditions => ['name like ?', "%#{search}%"],
:order => 'rank'}
if (sort_by != "all") then
paginate(page_returns.merge({ :per_page => 20, :page => page }))
else
paginate(page_returns.merge({ :per_page => 120, :page => page }))
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---