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

Fixes SQL exception from rails 5.2 upgrade #479

Merged

Conversation

lizzyaustad
Copy link
Contributor

@lizzyaustad lizzyaustad commented Jan 29, 2018

A change in the most recent beta version of Rails 5.2 wraps the query attribute in a BindParam node, making the attribute's value inaccessible when it comes back to cancancan.

If the change persists in the final version of Rails 5.2, SubstituteBinds could be a possible solution for avoiding the SQL error that is otherwise raised. Without this change, current active record adapter tests would fail for the 5.2.0.beta2 appraisal. I can update the gem to the non-beta version so this PR can be up to date once the final version is released if the issue still exists at that point.

@lizzyaustad lizzyaustad changed the title Fixes SQL exception from rails 5.2 upgrade (#478) Fixes SQL exception from rails 5.2 upgrade Jan 29, 2018
Copy link
Member

@coorasse coorasse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lizzyaustad , thanks for investigating that.
I would like to keep this PR open so that we are ready when Rails 5.2 is out of beta (I don't plan to release a version of cancancan to support Rails 5.2 until is out of beta).
When we are ready I'd prefer to have a activerecord_5_adapter.rb rather than extend the version 4 of it. this part you could already do if you have time. Thanks, nice job!

@jhawthorn
Copy link
Contributor

I would like to keep this PR open so that we are ready when Rails 5.2 is out of beta (I don't plan to release a version of cancancan to support Rails 5.2 until is out of beta).

5.2.0.rc1 is out if that counts 😉

@lizzyaustad
Copy link
Contributor Author

Hi @coorasse, I went ahead and updated to 5.2.0.rc1 and added an active_record_5_adapter. I noticed @s-mage already had one implemented here so I based it off of that in order to reduce conflicts. Let me know if there is anything else I should change.

Copy link
Member

@coorasse coorasse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks

@coorasse coorasse changed the base branch from develop to feature/2.2.0 March 12, 2018 18:13
@tvdeyen
Copy link

tvdeyen commented Mar 23, 2018

5.2.0.rc2 is now out. Is there anything blocking this from getting merged?

@coorasse
Copy link
Member

coorasse commented Apr 9, 2018

@lizzyaustad would you mind updating the PR to rc2? I would like to release this when also final 5.2 of Rails is out but we can merge it into a separate branch for the moment.

@lizzyaustad
Copy link
Contributor Author

@coorasse updated to rc2

@tvdeyen
Copy link

tvdeyen commented Apr 10, 2018

release this when also final 5.2 of Rails is out

@coorasse Rails 5.2 was released today. Any plans on releasing this? Thanks

@coorasse
Copy link
Member

please @lizzyaustad , can you use the final 5.2 and add your changes to the CHANGELOG? Then I can merge and release a new 2.2.0 version. Thank you very much for your work, really appreciated 👍

@lizzyaustad
Copy link
Contributor Author

Hi @coorasse, I've updated to the final 5.2 version of rails and added my change to the "Unreleased" section of the changelog. Let me know if there's anything else I should do. Thanks!

@coorasse coorasse merged commit bba63bb into CanCanCommunity:feature/2.2.0 Apr 12, 2018
@coorasse
Copy link
Member

Thank you! Nice job!

mshibuya pushed a commit to mshibuya/cancancan that referenced this pull request May 3, 2018
mshibuya pushed a commit to mshibuya/cancancan that referenced this pull request May 3, 2018
mshibuya pushed a commit to mshibuya/cancancan that referenced this pull request May 3, 2018
Hamms added a commit to code-dot-org/code-dot-org that referenced this pull request Nov 11, 2020
Required for the Rails 5.2 upgrade; specifically, CanCanCommunity/cancancan#479 is required to fix an ActiveRecord query issue that we're seeing on controllers with autoloaded resources.

Reading through the changelog, it looks like the only major changes between this and our previous version are [several deprecations](https:/CanCanCommunity/cancancan/blob/develop/CHANGELOG.md#200-may-18th-2017) for situations we aren't using.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants