You can clone with
No one assigned
in our logs we found this problem
ArgumentError: invalid value for Integer(): 'xoforvfmy' in "[GEM_ROOT]/gems/will_paginate-3.0.2/lib/will_paginate/page_number.rb" on line 16.
Some web crawler requested page=xoforvfmy
I tried to find best place to fix this, but failed.
I've been getting the same error periodically for the last couple weeks.
ArgumentError: invalid value for Integer(): "vvxvpgwxofhmvf"
(and: "jqhscznljnhlxr", "rixhuvnazokxf", "rksoidrehnh", "lbnbyiqvta")
best practice would be to check if your params id is a number and greater than 0, I also changed this in my fork and made a pull-reques
params[:page] = 'foobar'
posts = Post.where(:published => true).page(params[:page])
#posts.current_page = 1
# set default_page if necessary
posts = Post.where(:published => true).page(params[:page], :default_page => 10)
#posts.current_page = 10
# this raises no exception, it trys to return the default_page
have a look at #276
The exception is deliberate. However, in production will_paginate configures Rails to swallow these exceptions and return 404s. You shouldn't be seening those in the exception tracker.
If you see these exceptions in production, tell me your Rails version and output of rake middleware
@mislav I'm seeing this exception in production also.
Rails Version: 3.1.10
invalid value for Integer(): "6/"
will_paginate (3.0.3) lib/will_paginate/page_number.rb:16:in Integer'
will_paginate (3.0.3) lib/will_paginate/page_number.rb:16:ininitialize'
will_paginate (3.0.3) lib/will_paginate/page_number.rb:54:in new'
will_paginate (3.0.3) lib/will_paginate/page_number.rb:54:inPageNumber'
will_paginate (3.0.3) lib/will_paginate/active_record.rb:142:in page'
will_paginate (3.0.3) lib/will_paginate/active_record.rb:133:inpaginate'
will_paginate (3.0.3) lib/will_paginate/page_number.rb:16:in
will_paginate (3.0.3) lib/will_paginate/page_number.rb:54:in
will_paginate (3.0.3) lib/will_paginate/active_record.rb:133:in
OK, my bad. will_paginate just configures Rails to display a 404 for that exception in production, but the exception is still thrown internally, and exception trackers will log it.
I'll have to rethink this for future versions
I got this issue in production on website with a lot of traffic (always get strange wrong queries).
I think a quick & clean solution can be to add a rails route constraint to avoid hitting your controller with wrong values (and yeah otherwise it should raise, but maybe a custom exception would be nicer to catch it & render a 404. Oh, seems like it now the case, nvm.).
Anyway, here it goes for my solution on the routes level :
request.params[:page].nil? || /^\d+$/ =~ request.params[:page]
match '/', :action => :index, :controller => :publications,
:constraints => WillPaginateConstraint.new