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 1.2.1 confuses HAML when giving link_to_prev_page a block #1033

Open
abartov opened this issue Aug 30, 2020 · 5 comments
Open

Kaminari 1.2.1 confuses HAML when giving link_to_prev_page a block #1033

abartov opened this issue Aug 30, 2020 · 5 comments

Comments

@abartov
Copy link

abartov commented Aug 30, 2020

I have some old code that used to work perfectly, and stopped working after (only) upgrading Kaminari from 1.1.1 to 1.2.1.

The observed problem was mangled display, caused by HAML (5.0.4) bizarrely re-parsing the template from the beginning, resulting in actual HAML code emitted to the user. I have managed to isolate the bit triggering this behavior -- again, a bit I haven't changed at all, that worked just fine with 1.1.1, and that bit is:

= link_to_previous_page @works, '2', {class: 'by-icon-v02', remote: true, id: 'prevnav', title: t(:worklist_prev_page_tt)} do
  %span.by-icon-v02.navdisabled`
    = '2'`

This block I'm passing is causing the HAML failure, somehow. If I remove the 'do' and the following two lines, the link is emitted (or not, if there is no prev page) just fine.
I have confirmed that reverting to Kaminari 1.1.1 makes this code work again.

Any thoughts?

@ruurd
Copy link
Contributor

ruurd commented Dec 21, 2020

Is that from the kaminari views? And when updating from kaminari-1.1.1 to kaminari-1.2.1 did you also update those views?

@abartov
Copy link
Author

abartov commented Jan 2, 2021

Thanks for your attention! No, it's my own view.

@abartov
Copy link
Author

abartov commented May 2, 2021

(Noting that this is still an issue, and is keeping me from upgrading to kaminari-1.2.1, despite the security issue in 1.1.1. I am not able to debug this issue inside kaminari myself, regrettably. I hope someone else is, eventually.)

@ruurd
Copy link
Contributor

ruurd commented May 2, 2021

What happens if you take your own view out of the equation? Let me be clear I am not a regular contributor to kaminari but if I can assist you by asking stupid questions... :-) And since problem denial often is a workable solution - what happens if you change your view to erb since the problem seems to be haml related...

That said and having a look at my kaminari views that are in haml as well I see that the views for the links are using #link_to_unless instead of #link_to_previous_page ...

@abartov
Copy link
Author

abartov commented Feb 16, 2023

For the record:

  1. This is still consistently happening in 1.2.2
  2. Switching from link_to_previous_page to link_to 'label', prev_page_url(collection) solved the issue for me.

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