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

Documentation update for mandatory allowlist in 4.0 #1426

Open
jrochkind opened this issue Jun 20, 2023 · 1 comment
Open

Documentation update for mandatory allowlist in 4.0 #1426

jrochkind opened this issue Jun 20, 2023 · 1 comment

Comments

@jrochkind
Copy link

I was looking to update to ransack 4.0, which I discovered has a backwards incompatible change requiring an allowlist for attributes and associations per #1273 and #1400.

This was clearly marked in the CHANGELOG... and the error message you get if you dont' supply the allowlist is actually pretty good!

But I was surprised to see that much ransack documentation appears to not have been updated. Perhaps it should be? Some examples:

https://activerecord-hackery.github.io/ransack/getting-started/simple-mode/ says:

By default, searching and sorting are authorized on any column of your model. See Authorization (allowlisting/denylisting) on how to prevent this.

That's obviously wrong. If we follow the link to: https://activerecord-hackery.github.io/ransack/going-further/other-notes/#authorization-allowlistingdenylisting

It's kind of all wrong, starting with "here's how these four methods are implemented in ransack" -- nope, not anymore in 4.0.

All the "getting started" and other tutorial docs should probably be updated to actually provide examples of implementing the required ransackable_attributes etc methods?

Additionally, a little "migrating to 4.0" guide with migration advice would be very welcome. I was a bit surprised/dismayed to see that if I accidentally left out (eg) an attribute, I would not get an error even trying to include it with ransack, but it would just be no-op ignored. This makes it a bit harder to make sure you have fully migrated to ransack 4.0 and listed all necessary attributes. It might be nice if there were a configuration that would make things raise in those cases, that you might want to turn on when running tests for instance, to ease the migration.

@1c7
Copy link

1c7 commented Dec 26, 2023

Any updates?

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