Sha256: a68b29291bd65321c409bbc630a7fe7db256c65a3b7d8b99c67632f12d29ff8d
Contents?: true
Size: 454 Bytes
Versions: 5
Compression:
Stored size: 454 Bytes
Contents
# frozen_string_literal: true module Activatable extend ActiveSupport::Concern private def activation_toggle(resource) if resource.update(is_active: !resource.is_active) i18n_key = "flash.actions.toggle_is_active.#{resource.is_active ? 'active' : 'passive'}" flash[:info] = I18n.t(i18n_key, resource_name: resource.class.model_name.human) else flash[:danger] = I18n.t('flash.messages.error_occurred') end end end
Version data entries
5 entries across 5 versions & 1 rubygems