Tidy up latest commits, update CHANGELOG.

This commit is contained in:
José Valim 2011-08-30 10:50:12 +02:00
parent 79d89a3c20
commit 4222afe3c7
3 changed files with 15 additions and 21 deletions

View File

@ -2,6 +2,7 @@
* Use serialize_into_session and serialize_from_session in Warden serialize to improve extensibility
* bug fix
* Generator properly generates a change_table migration if a model already exists
* Properly deprecate setup_mail
* Fix encoding issues with email regexp
* Only generate helpers for the used mappings

View File

@ -11,19 +11,10 @@ module ActiveRecord
source_root File.expand_path("../templates", __FILE__)
def copy_devise_migration
exists = model_exists?
unless behavior == :revoke
unless exists
migration_template "migration.rb", "db/migrate/devise_create_#{table_name}"
else
migration_template "migration_existing.rb", "db/migrate/add_devise_to_#{table_name}"
end
if (behavior == :invoke && model_exists?) || (behavior == :revoke && migration_exists?(table_name))
migration_template "migration_existing.rb", "db/migrate/add_devise_to_#{table_name}"
else
if migration_exists?(table_name)
migration_template "migration_existing.rb", "db/migrate/add_devise_to_#{table_name}"
else
migration_template "migration.rb", "db/migrate/devise_create_#{table_name}"
end
migration_template "migration.rb", "db/migrate/devise_create_#{table_name}"
end
end

View File

@ -1,22 +1,24 @@
class AddDeviseTo<%= table_name.camelize %> < ActiveRecord::Migration
def self.up
change_table :<%= table_name %> do |t|
change_table(:<%= table_name %>) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
# t.encryptable
# t.confirmable
# t.lockable :lock_strategy => :<%= Devise.lock_strategy %>, :unlock_strategy => :<%= Devise.unlock_strategy %>
# t.token_authenticatable
# t.encryptable
# t.confirmable
# t.lockable :lock_strategy => :<%= Devise.lock_strategy %>, :unlock_strategy => :<%= Devise.unlock_strategy %>
# t.token_authenticatable
<% for attribute in attributes -%>
t.<%= attribute.type %> :<%= attribute.name %>
<% end -%>
#Uncomment below if timestamps were not included in your original model.
t.timestamps
# Uncomment below if timestamps were not included in your original model.
# t.timestamps
end
add_index :<%= table_name %>, :email, :unique => true
add_index :<%= table_name %>, :reset_password_token, :unique => true
# add_index :<%= table_name %>, :confirmation_token, :unique => true
@ -25,8 +27,8 @@ class AddDeviseTo<%= table_name.camelize %> < ActiveRecord::Migration
end
def self.down
#By default, we don't want to make any assumption about how to roll back a migration when your
#model already existed. Please edit below which fields you would like to remove in this migration.
# By default, we don't want to make any assumption about how to roll back a migration when your
# model already existed. Please edit below which fields you would like to remove in this migration.
raise ActiveRecord::IrreversibleMigration
end
end