cambiar las asociaciones de sitios y usuaries a traves de roles
This commit is contained in:
parent
4fee63acb6
commit
1bf3fc0128
1 changed files with 4 additions and 3 deletions
|
@ -8,9 +8,10 @@ class Site < ApplicationRecord
|
|||
friendly_id :name, use: %i[finders]
|
||||
|
||||
has_many :roles
|
||||
has_and_belongs_to_many :usuaries, class_name: 'Usuarie'
|
||||
has_and_belongs_to_many :invitades, class_name: 'Usuarie',
|
||||
join_table: 'invitades_sites'
|
||||
has_many :usuaries, -> { where('roles.rol = ?', 'usuarie') },
|
||||
through: :roles
|
||||
has_many :invitades, -> { where('roles.rol = ?', 'invitade') },
|
||||
through: :roles, source: :usuarie
|
||||
|
||||
# Carga el sitio Jekyll una vez que se inicializa el modelo
|
||||
after_initialize :load_jekyll!
|
||||
|
|
Loading…
Reference in a new issue