README.md in devise-multi_email-2.0.0 vs README.md in devise-multi_email-2.0.1
- old
+ new
@@ -47,10 +47,35 @@
t.string :email
t.boolean :primary
end
```
+You can choose whether or not users can login with an email address that is not the primary email address.
+
+```ruby
+Devise::MultiEmail.configure do |config|
+ # Default is `false`
+ config.only_login_with_primary_email = true
+end
+```
+
+The `autosave` is automatically enabled on the `emails` association by default. This is to ensure the `primary`
+flag is persisted for all emails when the primary email is changed. When `autosave` is not enabled on the association,
+only new emails are saved when the parent (e.g. `User`) record is saved. (Updates to already-persisted email records
+are not saved.)
+
+If you don't want `autosave` to be enabled automatically, you can disable this feature. What this will do is
+enable alternative behavior, which adds an `after_save` callback to the parent record and calls `email.save` on each email
+record where the `primary` value has changed.
+
+```ruby
+Devise::MultiEmail.configure do |config|
+ # Default is `true`
+ config.autosave_emails = false
+end
+```
+
### Configure custom association names
You may not want to use the association `user.emails` or `email.users`. You can customize the name of the associations used. Add your custom configurations to an initializer file such as `config/initializers/devise-multi_email.rb`.
_Note: model classes are inferred from the associations._
@@ -59,12 +84,11 @@
Devise::MultiEmail.configure do |config|
# Default is :user for Email model
config.parent_association_name = :team
# Default is :emails for parent (e.g. User) model
config.emails_association_name = :email_addresses
- # For backwards-compatibility, specify :primary_email_record
- # Default is :primary_email
- config.primary_email_method_name = :primary_email_record
+ # Default is :primary_email_record
+ config.primary_email_method_name = :primary_email
end
# Example use of custom association names
team = Team.first
emails = team.email_addresses