As a short elucidation, consider a stripped down version of the index 
method in the GenericController -- all the models use this vanilla index 
method from
GenericController.

  def index
    # index_setup is a routine that looks at session and params to
    # return the proper order claause, condition clause, and a filtered
    # list of ids for one or two special cases
    order, cond, filtered = index_setup session, params
    # user_rows is a user-defined rows per display table (we have widely
    # varying monitor resolutions in use at the office)
    rows = user_rows
    # since I unfortunately named one model Filter, I have to direct to
    # my filter class, not Rails' class
    #
    # but the views for all the models work in terms of @objects
    # as the instance var for returned models
    if params[:controller] == 'filters'
      @objects = ::Filter.paginate :conditions => cond, :page => 
params[:page], :per_page => rows, :order => order
    else
      # constantize rules...
      @objects = 
params[:controller].singularize.camelcase.constantize.paginate 
:conditions => cond, :page => params[:page], :per_page => rows, :order 
=> order
    end
  end

but that should get you the idea.
-- 
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