Class: TelegramBotEngine::Admin::AllowlistController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/telegram_bot_engine/admin/allowlist_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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.message
end

#destroyObject



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

#indexObject



8
9
10
# File 'app/controllers/telegram_bot_engine/admin/allowlist_controller.rb', line 8

def index
  @allowed_users = AllowedUser.order(:username)
end