app/controllers/plutus/entries_controller.rb in plutus-0.12.2 vs app/controllers/plutus/entries_controller.rb in plutus-0.13
- old
+ new
@@ -15,10 +15,15 @@
# @example
# GET /entries
# GET /entries.xml
# GET /entries.json
def index
- @entries = Entry.limit(100).order('date DESC')
+ if params[:order] == 'ascending'
+ order = 'ASC'
+ else
+ order = 'DESC'
+ end
+ @entries = Entry.page(params[:page]).per(params[:limit]).order("date #{order}")
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @entries }
format.json { render :json => @entries }