vectordotdev / timber-ruby

🌲 Great Ruby logging made easy.
https://timber.io
Other
154 stars 19 forks source link

Check for Devise using constant #157

Closed joshrowley closed 7 years ago

joshrowley commented 7 years ago

Hey @binarylogic , the latest release 2.2.1 didn't fix my issue, but this seems to do the trick.

What seems to be happening is that Devise is the gem requires 'devise' I believe to check if it's part of your gemset so that the timber middleware is initialized after the devise.omniauth initializer. This seems to set up the omniauth middleware.

Then we have our own Omniauth code that makes another call to config.omniauth which according to Devise sets the omniauth middleware up again and then breaks all authentication.

So, I think checking for the constant Devise would fulfill the same role as requiring the library, without reloading the omniauth initializer.

That being said, I'm not sure of the full consequences of this change, so figured I'd have you take a look 😄

joshrowley commented 7 years ago

i think you already added this in 😞

binarylogic commented 7 years ago

Hey @joshrowley, really appreciate you submitting this change. I was talking to Steve and he showed me your PR. To get a fix out quicker I went ahead and made the change. 2.2.2 has this change in place. Let me know if that resolves it. Sorry for the trouble!