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
|
* enhancements
|
||||||
* Added DataMapper support
|
* Added DataMapper support
|
||||||
* Remove store_location from authenticatable strategy and add it to failure app
|
* 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:
|
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
|
devise :authenticatable
|
||||||
|
|
||||||
# Include authenticatable + confirmable
|
# 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
|
end
|
||||||
|
|
||||||
# Inside your Admin model
|
# Inside your Admin model
|
||||||
devise :validatable
|
devise :authenticatable, :validatable
|
||||||
|
|
||||||
# Inside your routes
|
# Inside your routes
|
||||||
map.devise_for :admin
|
map.devise_for :admin
|
||||||
|
|
|
@ -50,35 +50,36 @@ module Devise
|
||||||
#
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
#
|
#
|
||||||
# # include only authenticatable module (default)
|
# # include only authenticatable module
|
||||||
# devise
|
# devise :authenticatable
|
||||||
#
|
#
|
||||||
# # include authenticatable + confirmable modules
|
# # include authenticatable + confirmable modules
|
||||||
# devise :confirmable
|
# devise :authenticatable, :confirmable
|
||||||
#
|
#
|
||||||
# # include authenticatable + recoverable modules
|
# # include authenticatable + recoverable modules
|
||||||
# devise :recoverable
|
# devise :authenticatable, :recoverable
|
||||||
#
|
#
|
||||||
# # include authenticatable + rememberable modules
|
# # include authenticatable + rememberable + validatable modules
|
||||||
# devise :rememberable
|
# devise :authenticatable, :rememberable, :validatable
|
||||||
#
|
#
|
||||||
# # include authenticatable + validatable modules
|
# # shortcut to include all available modules
|
||||||
# devise :validatable
|
|
||||||
#
|
|
||||||
# # include authenticatable + confirmable + recoverable + rememberable + validatable
|
|
||||||
# devise :confirmable, :recoverable, :rememberable, :validatable
|
|
||||||
#
|
|
||||||
# # shortcut to include all modules (same as above)
|
|
||||||
# devise :all
|
# devise :all
|
||||||
#
|
#
|
||||||
# # include all except recoverable
|
# # include all except recoverable
|
||||||
# devise :all, :except => :recoverable
|
# devise :all, :except => :recoverable
|
||||||
#
|
#
|
||||||
def devise(*modules)
|
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!
|
options = modules.extract_options!
|
||||||
modules = Devise.all if modules.include?(:all)
|
modules = Devise.all if modules.include?(:all)
|
||||||
modules -= Array(options.delete(:except))
|
modules -= Array(options.delete(:except))
|
||||||
modules = [:authenticatable] | modules
|
|
||||||
|
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
|
Devise.orm_class.included_modules_hook(self, modules) do
|
||||||
modules.each do |m|
|
modules.each do |m|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module Devise
|
module Devise
|
||||||
VERSION = "0.5.6".freeze
|
VERSION = "0.6.0".freeze
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
require 'test/test_helper'
|
require 'test/test_helper'
|
||||||
|
|
||||||
class Authenticable < User
|
class Authenticable < User
|
||||||
devise
|
devise :authenticatable
|
||||||
end
|
end
|
||||||
|
|
||||||
class Confirmable < User
|
class Confirmable < User
|
||||||
devise :confirmable
|
devise :authenticatable, :confirmable
|
||||||
end
|
end
|
||||||
|
|
||||||
class Recoverable < User
|
class Recoverable < User
|
||||||
devise :recoverable
|
devise :authenticatable, :recoverable
|
||||||
end
|
end
|
||||||
|
|
||||||
class Rememberable < User
|
class Rememberable < User
|
||||||
devise :rememberable
|
devise :authenticatable, :rememberable
|
||||||
end
|
end
|
||||||
|
|
||||||
class Validatable < User
|
class Validatable < User
|
||||||
devise :validatable
|
devise :authenticatable, :validatable
|
||||||
end
|
end
|
||||||
|
|
||||||
class Devisable < User
|
class Devisable < User
|
||||||
|
@ -36,7 +36,6 @@ class Configurable < User
|
||||||
end
|
end
|
||||||
|
|
||||||
class ActiveRecordTest < ActiveSupport::TestCase
|
class ActiveRecordTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
def include_module?(klass, mod)
|
def include_module?(klass, mod)
|
||||||
klass.devise_modules.include?(mod) &&
|
klass.devise_modules.include?(mod) &&
|
||||||
klass.included_modules.include?(Devise::Models::const_get(mod.to_s.classify))
|
klass.included_modules.include?(Devise::Models::const_get(mod.to_s.classify))
|
||||||
|
|
Loading…
Reference in New Issue