Bill Clinton
2006-May-23 11:34 UTC
[Rails] Wierd pagination problem - Unknown options: order?
I am trying to use pagination with the order option. I am following examples I''ve seen all over the web, but I am getting an error. My code seems simple: def list @upload_pages, @uploads = paginate :uploads, :per_page => 20, :order => ''id'' end Yet I keep getting this error: ___________________________________________ ActionController::ActionControllerError in Data#list Unknown options: order /app/controllers/data_controller.rb:12:in `list'' /home/bclinton/work/eds/script/server:51 ___________________________________________ If I take the order option out, it works fine. Anyone have any idea what I am doing wrong here? -- Posted via http://www.ruby-forum.com/.
Mike Oligny
2006-May-23 11:38 UTC
[Rails] Wierd pagination problem - Unknown options: order?
On 23-May-06, at 6:34 AM, Bill Clinton wrote:> > I am trying to use pagination with the order option. I am following > examples I''ve seen all over the web, but I am getting an error. My > code > seems simple: > > def list > @upload_pages, @uploads = paginate :uploads, :per_page => > 20, :order > => ''id'' > endTry putting your parameters in parentheses: @upload_pages, @uploads = paginate ( :uploads, :per_page => 20, :order => ''id'')
Mike Oligny
2006-May-23 11:40 UTC
[Rails] Wierd pagination problem - Unknown options: order?
On 23-May-06, at 6:38 AM, Mike Oligny wrote:> Try putting your parameters in parentheses: > > @upload_pages, @uploads = paginate ( :uploads, :per_page => > 20, :order => ''id'')oops - the space before/after the ( was unintentional.
Bill Clinton
2006-May-23 12:09 UTC
[Rails] Re: Wierd pagination problem - Unknown options: order?
Mike Oligny wrote:> On 23-May-06, at 6:34 AM, Bill Clinton wrote: > >> end > Try putting your parameters in parentheses: > > @upload_pages, @uploads = paginate ( :uploads, :per_page => > 20, :order => ''id'')Thanks for the suggestion, it was something I hadn''t tried. Unfortunately I still get the same error. Here is my code now (the commented line works): def list @upload_pages, @uploads = paginate(:uploads, :per_page => 20, :order => ''id'') # @upload_pages, @uploads = paginate(:uploads, :per_page => 20) end Here is the beginning of the trace in case it helps: /vendor/actionpack/lib/action_controller/pagination.rb:86:in `validate_options!'' /vendor/actionpack/lib/action_controller/pagination.rb:110:in `paginate'' /vendor/actionpack/lib/action_controller/base.rb:756:in `perform_action_without_filters'' /vendor/actionpack/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark'' /vendor/actionpack/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' /vendor/actionpack/lib/action_controller/benchmarking.rb:41:in `measure'' -- Posted via http://www.ruby-forum.com/.
Mike Oligny
2006-May-23 12:28 UTC
[Rails] Re: Wierd pagination problem - Unknown options: order?
On 23-May-06, at 7:06 AM, Bill Clinton wrote:> Thanks for the suggestion, it was something I hadn''t tried. > Unfortunately I still get the same error. Here is my code now (the > commented line works): > > def list > @upload_pages, @uploads = paginate(:uploads, :per_page => > 20, :order > => ''id'') > # @upload_pages, @uploads = paginate(:uploads, :per_page => 20) > endAre you using 1.1.2? :order option appears to have been added on August 23 - you could check actionpack/lib/action_controller/ pagination.rb (around line 70) for :order in this: DEFAULT_OPTIONS = { :class_name => nil, :singular_name => nil, :per_page => 10, :conditions => nil, :order_by => nil, :order => nil, :join => nil, :joins => nil, :count => nil, :include => nil, :select => nil, :parameter => ''page'' } I''m fairly new to this myself, so I''m not really sure what else to suggest if your stuff is all current.
Philipp Engel
2006-May-23 15:01 UTC
[Rails] Wierd pagination problem - Unknown options: order?
Hello there, Bill Clinton wrote:> I am trying to use pagination with the order option. I am following > examples I''ve seen all over the web, but I am getting an error. My code > seems simple: > > def list > @upload_pages, @uploads = paginate :uploads, :per_page => 20, :order > => ''id'' > end > > Yet I keep getting this error: > Unknown options: orderI can''t really test it now but I think the problem is that the method paginate does only expect two parameters, and you gave it three. I would try something like this: @upload_pages, @uploads = paginate :uploads, {:per_page => 20, :order => ''id''} I hope that helps. Greetings, Philipp -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin http://www.filzip.com