Do not include :authenticatable by default (deprecation warning added) and release Devise 0.6.0.
This commit is contained in:
parent
a016819de8
commit
39cf987b6b
|
@ -1,3 +1,8 @@
|
|||
== 0.6.0
|
||||
|
||||
* deprecations
|
||||
* :authenticatable is not included by default anymore
|
||||
|
||||
* enhancements
|
||||
* Added DataMapper support
|
||||
* Remove store_location from authenticatable strategy and add it to failure app
|
||||
|
|
|
@ -74,7 +74,7 @@ This line adds devise authenticatable automatically for you inside your User cla
|
|||
|
||||
You could also include the other devise modules as below:
|
||||
|
||||
# Same as using only devise, authenticatable is activated by default
|
||||
# Include only authenticatable stuff
|
||||
devise :authenticatable
|
||||
|
||||
# Include authenticatable + confirmable
|
||||
|
@ -150,7 +150,7 @@ Devise let's you setup as many roles as you want, so let's say you already have
|
|||
end
|
||||
|
||||
# Inside your Admin model
|
||||
devise :validatable
|
||||
devise :authenticatable, :validatable
|
||||
|
||||
# Inside your routes
|
||||
map.devise_for :admin
|
||||
|
|
|
@ -50,35 +50,36 @@ module Devise
|
|||
#
|
||||
# Examples:
|
||||
#
|
||||
# # include only authenticatable module (default)
|
||||
# devise
|
||||
# # include only authenticatable module
|
||||
# devise :authenticatable
|
||||
#
|
||||
# # include authenticatable + confirmable modules
|
||||
# devise :confirmable
|
||||
# devise :authenticatable, :confirmable
|
||||
#
|
||||
# # include authenticatable + recoverable modules
|
||||
# devise :recoverable
|
||||
# devise :authenticatable, :recoverable
|
||||
#
|
||||
# # include authenticatable + rememberable modules
|
||||
# devise :rememberable
|
||||
# # include authenticatable + rememberable + validatable modules
|
||||
# devise :authenticatable, :rememberable, :validatable
|
||||
#
|
||||
# # include authenticatable + validatable modules
|
||||
# devise :validatable
|
||||
#
|
||||
# # include authenticatable + confirmable + recoverable + rememberable + validatable
|
||||
# devise :confirmable, :recoverable, :rememberable, :validatable
|
||||
#
|
||||
# # shortcut to include all modules (same as above)
|
||||
# # shortcut to include all available modules
|
||||
# devise :all
|
||||
#
|
||||
# # include all except recoverable
|
||||
# devise :all, :except => :recoverable
|
||||
#
|
||||
def devise(*modules)
|
||||
# TODO Add this check in future versions
|
||||
# raise "You need to give at least one Devise module" if modules.empty?
|
||||
|
||||
options = modules.extract_options!
|
||||
modules = Devise.all if modules.include?(:all)
|
||||
modules -= Array(options.delete(:except))
|
||||
|
||||
if !modules.include?(:authenticatable)
|
||||
modules = [:authenticatable] | modules
|
||||
ActiveSupport::Deprecation.warn ":authenticatable won't be included by default in devise in future versions, please add it", caller[0,10]
|
||||
end
|
||||
|
||||
Devise.orm_class.included_modules_hook(self, modules) do
|
||||
modules.each do |m|
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module Devise
|
||||
VERSION = "0.5.6".freeze
|
||||
VERSION = "0.6.0".freeze
|
||||
end
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
require 'test/test_helper'
|
||||
|
||||
class Authenticable < User
|
||||
devise
|
||||
devise :authenticatable
|
||||
end
|
||||
|
||||
class Confirmable < User
|
||||
devise :confirmable
|
||||
devise :authenticatable, :confirmable
|
||||
end
|
||||
|
||||
class Recoverable < User
|
||||
devise :recoverable
|
||||
devise :authenticatable, :recoverable
|
||||
end
|
||||
|
||||
class Rememberable < User
|
||||
devise :rememberable
|
||||
devise :authenticatable, :rememberable
|
||||
end
|
||||
|
||||
class Validatable < User
|
||||
devise :validatable
|
||||
devise :authenticatable, :validatable
|
||||
end
|
||||
|
||||
class Devisable < User
|
||||
|
@ -36,7 +36,6 @@ class Configurable < User
|
|||
end
|
||||
|
||||
class ActiveRecordTest < ActiveSupport::TestCase
|
||||
|
||||
def include_module?(klass, mod)
|
||||
klass.devise_modules.include?(mod) &&
|
||||
klass.included_modules.include?(Devise::Models::const_get(mod.to_s.classify))
|
||||
|
|
Loading…
Reference in New Issue