Class: TokenAuth::ConfigurationTokensController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- TokenAuth::ConfigurationTokensController
- Defined in:
- app/controllers/token_auth/configuration_tokens_controller.rb
Overview
Manages Configuration Tokens.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/token_auth/configuration_tokens_controller.rb', line 6 def create token = ConfigurationToken.new(entity_id: params[:entity_id]) if token.save redirect_to tokens_index, notice: t("activerecord.success_saving", name: token.class.model_name.human) else redirect_to tokens_index, alert: t("activerecord.failure_saving", name: token.class.model_name.human, errors: errors_on(token)) end end |
#destroy ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/token_auth/configuration_tokens_controller.rb', line 21 def destroy token = ConfigurationToken.find_by(entity_id: params[:entity_id]) if token.nil? redirect_to tokens_index, alert: t("activerecord.cannot_find", name: ConfigurationToken.model_name.human) elsif token.destroy redirect_to tokens_index, notice: t("activerecord.success_destroying", name: ConfigurationToken.model_name.human) else redirect_to tokens_index, alert: t("activerecord.failure_destroying", name: ConfigurationToken.model_name.human, errors: errors_on(token)) end end |