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

Preserve existing page variables? #39

Open
homerjon opened this issue Apr 18, 2015 · 1 comment
Open

Preserve existing page variables? #39

homerjon opened this issue Apr 18, 2015 · 1 comment

Comments

@homerjon
Copy link

Here is my existing query.

@workingaccount = Account.find(params[:id])
@accounts, @alphaParams = Account.alphabetical.all.alpha_paginate(params[:letter], {:default_field => "all", :others => true, :js => false, :bootstrap3 => true, :paginate_all => true}){|account| account.name}

Is there a way to preserve the existing page variable?

account/?id=5&letter=all

It would be great if you could add existing page variable to the call like such

@accounts, @alphaParams = Account.alphabetical.all.alpha_paginate(params[:letter], {:default_field => "all", :others => true, :js => false, :bootstrap3 => true, :paginate_all => true, param=>{:id => params[:id]}}){|account| account.name}

This is how will_paginate handles it

<%= will_paginate @accounts, :params => {:id => params[:id]}, :class => 'pagination' %>

@nlevchuk
Copy link
Contributor

@homerjon i think will_paginate's approach better, because this params will be used in forming urls only. For example,

<%= alphabetical_paginate @alphaParams, params: { id: params[:id] } %>

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