Class: TelegramBotEngine::Admin::AllowlistController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- TelegramBotEngine::Admin::AllowlistController
- Defined in:
- app/controllers/telegram_bot_engine/admin/allowlist_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 |
# File 'app/controllers/telegram_bot_engine/admin/allowlist_controller.rb', line 12 def create AllowedUser.create!(allowed_user_params) redirect_to admin_allowlist_index_path, notice: "Username added to allowlist." rescue ActiveRecord::RecordInvalid => e redirect_to admin_allowlist_index_path, alert: e. end |
#destroy ⇒ Object
19 20 21 22 23 |
# File 'app/controllers/telegram_bot_engine/admin/allowlist_controller.rb', line 19 def destroy allowed_user = AllowedUser.find(params[:id]) allowed_user.destroy! redirect_to admin_allowlist_index_path, notice: "Username removed from allowlist." end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/telegram_bot_engine/admin/allowlist_controller.rb', line 8 def index @allowed_users = AllowedUser.order(:username) end |