mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Do not check class collisions, we want to be able to scaffold and then apply Devise on top of it.
This commit is contained in:
parent
b04241ddff
commit
4f4ac1653f
3 changed files with 3 additions and 12 deletions
|
@ -4,9 +4,6 @@ class DeviseGenerator < Rails::Generator::NamedBase
|
|||
|
||||
def manifest
|
||||
record do |m|
|
||||
# Check for class naming collisions.
|
||||
m.class_collisions(class_name)
|
||||
|
||||
# Model
|
||||
m.directory(File.join('app', 'models', class_path))
|
||||
m.template 'model.rb', File.join('app', 'models', "#{file_path}.rb")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class DeviseCreate<%= table_name.camelize %> < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table(:<%= table_name %>) do |t|
|
||||
t.authenticatable :encryptor => :sha1
|
||||
t.authenticatable :encryptor => :sha1, :null => false
|
||||
t.confirmable
|
||||
t.recoverable
|
||||
t.rememberable
|
||||
|
|
|
@ -8,17 +8,11 @@ module Devise
|
|||
# == Options
|
||||
# * :null - When true, allow columns to be null.
|
||||
# * :encryptor - The encryptor going to be used, necessary for setting the proper encrypter password length.
|
||||
# * :skip_email - If you want to use another authentication key, you can skip e-mail creation.
|
||||
# If you are using an ORM where the devise declaration is in the same class as the schema,
|
||||
# as in Datamapper or Mongomapper, the email is skipped automatically if not included in
|
||||
# authentication_keys.
|
||||
def authenticatable(options={})
|
||||
null = options[:null] || false
|
||||
null = options[:null] || false
|
||||
encryptor = options[:encryptor] || (respond_to?(:encryptor) ? self.encryptor : :sha1)
|
||||
have_email = respond_to?(:authentication_keys) ? self.authentication_keys.include?(:email) : true
|
||||
skip_email = options[:skip_email] || !have_email
|
||||
|
||||
apply_schema :email, String, :null => null, :limit => 100 unless skip_email
|
||||
apply_schema :email, String, :null => null, :limit => 100
|
||||
apply_schema :encrypted_password, String, :null => null, :limit => Devise::ENCRYPTORS_LENGTH[encryptor]
|
||||
apply_schema :password_salt, String, :null => null, :limit => 20
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue