class ProductPolicy < ApplicationPolicy def index? record.platform.main? end def show? PlatformPolicy.new(user, record.platform).show? end alias_method :read?, :show? def create? record.platform.main? && local_admin?(record.platform) end alias_method :clone?, :create? alias_method :destroy?, :create? alias_method :update?, :create? end