lib/devise.rb in devise-1.1.pre2 vs lib/devise.rb in devise-1.1.pre3
- old
+ new
@@ -19,16 +19,10 @@
autoload :RestfulAuthenticationSha1, 'devise/encryptors/restful_authentication_sha1'
autoload :Sha512, 'devise/encryptors/sha512'
autoload :Sha1, 'devise/encryptors/sha1'
end
- module Orm
- autoload :ActiveRecord, 'devise/orm/active_record'
- autoload :DataMapper, 'devise/orm/data_mapper'
- autoload :MongoMapper, 'devise/orm/mongo_mapper'
- end
-
ALL = []
# Authentication ones first
ALL.push :authenticatable, :http_authenticatable, :token_authenticatable, :rememberable
@@ -103,18 +97,10 @@
# Store scopes mappings.
mattr_accessor :mappings
@@mappings = ActiveSupport::OrderedHash.new
- # Stores the chosen ORM.
- mattr_accessor :orm
- @@orm = :active_record
-
- # TODO Remove
- mattr_accessor :all
- @@all = []
-
# Tells if devise should apply the schema in ORMs where devise declaration
# and schema belongs to the same class (as Datamapper and MongoMapper).
mattr_accessor :apply_schema
@@apply_schema = true
@@ -161,10 +147,22 @@
# a fresh initializer with all configuration values.
def setup
yield self
end
+ # TODO Remove me on 1.1.0 final
+ def orm=(value)
+ ActiveSupport::Deprecation.warn "Devise.orm= and config.orm= are deprecated. " <<
+ "Just load \"devise/orm/\#{ORM_NAME}\" if Devise supports your ORM"
+ end
+
+ # TODO Remove me on 1.1.0 final
+ def default_url_options
+ ActiveSupport::Deprecation.warn "Devise.default_url_options and config.default_url_options are deprecated. " <<
+ "Just modify ApplicationController.default_url_options and Devise will automatically pick it up"
+ end
+
# Sets warden configuration using a block that will be invoked on warden
# initialization.
#
# Devise.initialize do |config|
# config.confirm_within = 2.days
@@ -176,29 +174,19 @@
# end
def warden(&block)
@warden_config = block
end
- # Configure default url options to be used within Devise and ActionController.
- def default_url_options(&block)
- Devise::Mapping.metaclass.send :define_method, :default_url_options, &block
- end
-
# A method used internally to setup warden manager from the Rails initialize
# block.
def configure_warden(config) #:nodoc:
config.default_strategies *Devise::STRATEGIES
config.failure_app = Devise::FailureApp
config.silence_missing_strategies!
config.default_scope = Devise.default_scope
# If the user provided a warden hook, call it now.
@warden_config.try :call, config
- end
-
- # The class of the configured ORM
- def orm_class
- Devise::Orm.const_get(@@orm.to_s.camelize.to_sym)
end
# Generate a friendly string randomically to be used as token.
def friendly_token
ActiveSupport::SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n")