Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kaminari pagination param issue when the param key is a number #1589

Closed
AbdullahAli opened this issue Aug 14, 2012 · 1 comment
Closed

kaminari pagination param issue when the param key is a number #1589

AbdullahAli opened this issue Aug 14, 2012 · 1 comment

Comments

@AbdullahAli
Copy link

When you try to pass in a param key as a number, the active_admin / kaminari integration fails as follows:

eg:
http://localhost:3000/admin/admin_users?345345=345345

Will cause this error, since the URL is not sanitized properly :

SyntaxError in Admin/admin_users#index

Showing /Users/login/.rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/app/views/kaminari/_paginator.html.erb where line #1 raised:

/Users/login/.rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/app/views/kaminari/_paginator.html.erb:1: syntax error, unexpected '=', expecting keyword_end
...uffer = @output_buffer;345345 = local_assigns[:345345];curre...
...                               ^
/Users/login/.rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/app/views/kaminari/_paginator.html.erb:1: syntax error, unexpected tINTEGER, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
...;345345 = local_assigns[:345345];current_page = local_assign...
...                               ^

Extracted source (around line #1):

1: <%# The container tag
2:   - available local variables
3:     current_page:  a page object for the currently displayed page
4:     num_pages:     total number of pages

Trace of template inclusion: /Users/login/.rvm/gems/ruby-1.9.3-p194/gems/kaminari-0.13.0/app/views/kaminari/_paginator.html.erb, /Users/login/.bundler/ruby/1.9.1/active_admin-313093389371/app/views/active_admin/resource/index.html.arb

Rails.root: /Users/login/Desktop/abduls_project
Application Trace | Framework Trace | Full Trace

app/admin/views/components/paginated_collection.rb:8:in `block in build_pagination_with_formats'
app/admin/views/components/paginated_collection.rb:7:in `build_pagination_with_formats'

Request

Parameters:

{"345345"=>"345345",
 "order"=>"id_desc"}

Any idea how to resolve this? OR is this a bug?

@jpmckinney
Copy link
Contributor

This is a Kaminari bug. Please report it there. Using numbers as parameters is very unusual, though. Why do you have to do it that way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants