demarches-normaliennes/app/models/gestionnaire.rb

19 lines
524 B
Ruby
Raw Normal View History

2015-09-22 10:15:12 +02:00
class Gestionnaire < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_and_belongs_to_many :administrateurs
2016-06-20 17:37:04 +02:00
has_many :assign_to, dependent: :destroy
has_many :procedures, through: :assign_to
has_many :dossiers, through: :procedures
def dossiers_filter
dossiers.where(procedure_id: procedure_filter_list)
end
def procedure_filter_list
procedure_filter.empty? ? procedures.pluck(:id) : procedure_filter
end
2015-09-22 10:15:12 +02:00
end