mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-13 23:48:55 +01:00
08244d53dc
- do not eager load trainings availabilities in INDEX action if not requsted - in trainings monitoring (font), do not load all availabilities for all traninings by default, by select a training first to load its availabilities
18 lines
314 B
Ruby
18 lines
314 B
Ruby
class TrainingPolicy < ApplicationPolicy
|
|
class Scope < Scope
|
|
def resolve
|
|
scope.includes(:plans, :machines)
|
|
end
|
|
end
|
|
|
|
%w(show create update).each do |action|
|
|
define_method "#{action}?" do
|
|
user.is_admin?
|
|
end
|
|
end
|
|
|
|
def destroy?
|
|
user.is_admin? and record.destroyable?
|
|
end
|
|
end
|