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

acts_as_token_authenticatable adds unnecessary methods to ActiveRecord::Base #345

Open
philayres opened this issue Feb 7, 2019 · 0 comments

Comments

@philayres
Copy link

philayres commented Feb 7, 2019

While working through the PR for #300 I found that adding an override for the attribute authentication_token caused one of my Rails apps to fail. This was reporting ActiveRecord::DangerousAttributeError on the attribute.

After digging around I found that acts_as_token_authenticatable really doesn't do much. The file it is defined in gets applied to ActiveRecord::Base, which meant that all changes made in there become part of that Base class. This led to ActiveRecord noticing that the attribute I was attempting to override was overriding what it considered to be core ActiveRecord functionality.

I have worked up a PR to split out acts_as_token_authenticatable so that the underlying functionality is only applied to the models the method call appears in. This follows the approach I see you already have for the controller handler acts_as_token_authentication_handler.

Unfortunately this PR was worked up based on the work already done for #300. It doesn't make sense in my opinion to go back and rework everything against the current version, so I propose that the PRs for this issue and #300 be adopted together. I hope you are OK with that.

I'll submit the new PR once we've made progress on the first one.

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

1 participant