Skip to content

Instantly share code, notes, and snippets.

@littlemove
Created April 13, 2011 12:36
Show Gist options
  • Select an option

  • Save littlemove/917457 to your computer and use it in GitHub Desktop.

Select an option

Save littlemove/917457 to your computer and use it in GitHub Desktop.
class Admin::WadusController < ApplicationController
before_filter :require_admin
layout "admin"
inherit_resources
respond_to :html
back_section :contents
protected
def collection
# Las funciones get_collection_ivar son de inherited_resources.
# Lo que hace es, dependiendo del controlador:
# @pages ||= end_of_association_chain....
# ó @html_items ||= end_of_association_chain....
get_collection_ivar || set_collection_ivar(end_of_association_chain.paginate(:page => params[:page], :per_page => 20, :order => 'created_at DESC'))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment