Okay here's what I did and yes, it's a lot shorter (thanks!):

  named_scope :compiled_this_week, lambda { { :conditions => 
['compiled_on > ? and compiled_on < ?', Time.now.beginning_of_week, 
Time.now.end_of_week] } }

  def self.do_sort(sort_by, search, page)
    (sort_by == "all") ? numpages = 120 : numpages = 20
    compiled_this_week.paginate( :conditions => ['name like ?', 
"%#{search}%"], :order => 'rank', :per_page => numpages, :page => page )
  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
-~----------~----~----~----~------~----~------~--~---

Reply via email to