1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-13 23:48:55 +01:00
fab-manager/app/policies/training_policy.rb
Sylvain 08244d53dc improve trainings load times
- 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
2016-06-15 12:01:09 +02:00

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