A lot shorter now:

== Rushing Offenses Model ==

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

  def self.list(search, page, numteams = 20)
    compiled_this_week.paginate :conditions => ['name like ?', 
"%#{search}%"], :order => 'rank', :per_page => numteams, :page => page
  end

== Rushing Offenses Controller ==

@rushing_offenses = RushingOffense.list(params[:search], params[:page], 
params[:numteams])

== Rushing Offenses index.html ==

        <%= link_to "Show All Teams", rushing_offenses_path(:numteams => 
120) %>
        <%= will_paginate @rushing_offenses, :prev_label => '<<', 
:next_label => '>>', :container => false %>

=======================

changed per_page variable to numteams (makes more sense)

The code is a lot shorter now and it makes more sense to me.  However, 
the default page views still show 30 teams instead of 20.  Why is it 
adding 10 somewhere?  I've checked all 3 files (what's listed here is 
what's listed there..)

-- 
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