mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 00:26:22 +00:00
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