simple_token_authentication
simple_token_authentication copied to clipboard
active_record.belongs_to_required_by_default functionality is disabled/overridden
The Problem
After installing 'simple_token_authentication', tests, that ensure belongs_to associations are required, now fail (presence is required by default in Rails 5). I tried removing each change and it occurs once the gem is required in the Gemfile.
The Cause
I haven't nailed down the cause, but I have found a workaround...
A Workaround
- In your Gemfile, use
require :false
for simple_token_authentication. -
require 'simple_token_authentication
before its first use. For me, that is inconfig/initializers/simple_token_authentication.rb
The Nitty Gritty
- rails (5.0.1)
- activerecord (5.0.1)
- simple_token_authentication (1.15.1)
Anyone have any ideas?
Hi @mattscilipoti,
Thanks for the report, I see no obvious reason of why this would occur but I'll think about it and let you know if I think of something. Anyone else, please comment here, ideas are welcome! Hopefully it's something we can get to understand properly : )
I tried tracing this back. The issue existed when Rails 5 support was added in SHA: 383419955503b9ba8b111cae9351dc92f347d296.
I found a similar issue in acts_as_list (https://github.com/swanandp/acts_as_list/issues/268). The workaround I used here didn't work. I was able to trace it to a specific commit in that project, but I haven't identified the cause.
Mmm, I'm sorry I missed your update @mattscilipoti. It sounds like something in the Simple Token Authentication dependencies changed that the acts as pattern depends on, I've no idea at this point what it could be. Did you find out more eventually?