5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 18:56:21 +00:00

cambiar las asociaciones de sitios y usuaries a traves de roles

This commit is contained in:
f 2019-07-08 14:08:06 -03:00
parent 4fee63acb6
commit 1bf3fc0128
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D

View file

@ -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!