diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-05 22:43:05 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-05 22:43:05 +0100 |
commit | 6045b6cb1880b27e8b21799b9501a794a5f5b88b (patch) | |
tree | 415169b028c44d15da6a4ddaf152175ff8f1fcc0 /app/models | |
parent | 7e93da3f8d31041034ba4eece5ee7a2cec5cfd2b (diff) |
Customizing devise views and controllers
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 1 | ||||
-rw-r--r-- | app/models/user.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 6a4aa16b4..47e43f0ac 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1,6 +1,7 @@ class Account < ActiveRecord::Base # Local users has_one :user, inverse_of: :account + validates :username, uniqueness: { scope: :domain } # Avatar upload attr_reader :avatar_remote_url diff --git a/app/models/user.rb b/app/models/user.rb index 999aa0d39..038ff21c6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,6 +2,7 @@ class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable belongs_to :account, inverse_of: :user + accepts_nested_attributes_for :account validates :account, presence: true end |