simple_token_authentication icon indicating copy to clipboard operation
simple_token_authentication copied to clipboard

active_record.belongs_to_required_by_default functionality is disabled/overridden

Open mattscilipoti opened this issue 7 years ago • 4 comments

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 in config/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?

mattscilipoti avatar Mar 23 '17 22:03 mattscilipoti

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 : )

gonzalo-bulnes avatar Mar 24 '17 07:03 gonzalo-bulnes

I tried tracing this back. The issue existed when Rails 5 support was added in SHA: 383419955503b9ba8b111cae9351dc92f347d296.

mattscilipoti avatar Apr 10 '17 20:04 mattscilipoti

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.

mattscilipoti avatar Apr 10 '17 20:04 mattscilipoti

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?

gonzalo-bulnes avatar Aug 06 '17 13:08 gonzalo-bulnes