NoamB/sorcery — Issue #85: a note about sorcery and refinerycms
Author: GutenYe
Created: 2011-10-08 14:15:49+00:00
State: open

\# Gemfile # works

gem 'sorcery'
gem 'refinerycms'

The 'sorcery' gem need to be placed before 'rerinferycms' gem, otherwise it won't work.

under the hood, for example

\# Gemfile # don't work in production mode

gem 'refinerycms'
gem 'sorcery'

when require 'refinerycms', it loads User model (I don't know how), which calls `User#authenticates_with_sorcery!`, but it's not ready. We need first require 'sorcery', which call [ ActionController::Base.send(:include, Sorcery::Controller)](https://github.com/NoamB/sorcery/blob/master/lib/sorcery/engine.rb#L11), it prepare [user_config](https://github.com/NoamB/sorcery/blob/master/lib/sorcery/controller.rb#L182) for `User#authenticates_with_sorcery!`

this ISSUE takes me a very long time to find it out. I think it should add to documentation in case someone need it.