1
0
Fork 0

Create account roles with lock to avoid duplicates

This commit is contained in:
Alex Kotov 2019-07-08 18:16:56 +05:00
parent 77568c425e
commit f96cd44c3b
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

View file

@ -101,7 +101,7 @@ class Account < ApplicationRecord
self.class.define_dynamic_method role.name, resource
end
roles << role
account_roles.where(role: role).first_or_create!
role
end