1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Use ActiveSupport.on_load to hook into Active Record and Mongoid.

This commit is contained in:
Lucas Mazza 2016-06-27 14:54:48 -03:00
parent 92bb772d36
commit c2c74b0a39
No known key found for this signature in database
GPG key ID: C009F9A6BE4A44CB
3 changed files with 9 additions and 3 deletions

View file

@ -12,6 +12,8 @@
* Remove the `Devise::Models::Recoverable#after_password_reset` method.
* bug fixes
* Fix an `ActionDispatch::IllegalStateError` when testing controllers with Rails 5 rc 2(by @hamadata).
* Use `ActiveSupport.on_load` hooks to include Devise on `ActiveRecord` and `Mongoid`,
avoiding autoloading these constants too soon (by @lucasmazza, @rafaelfranca).
* enhancements
* Display the minimum password length on `registrations/edit` view (by @Yanchek99).
* You can disable Devise's routes reloading on boot by through the `reload_routes = false` config.

View file

@ -1,3 +1,5 @@
require 'orm_adapter/adapters/active_record'
ActiveRecord::Base.extend Devise::Models
ActiveSupport.on_load(:active_record) do
extend Devise::Models
end

View file

@ -1,3 +1,5 @@
require 'orm_adapter/adapters/mongoid'
ActiveSupport.on_load(:mongoid) do
require 'orm_adapter/adapters/mongoid'
Mongoid::Document::ClassMethods.send :include, Devise::Models
Mongoid::Document::ClassMethods.send :include, Devise::Models
end