ask/app/controllers/admin/ask_admins_controller.rb

46 lines
910 B
Ruby

# encoding: utf-8
class Admin::AskAdminsController < OrbitAdminController
def initialize
super
@app_title = 'ask'
end
def index
@ask_admin = AskAdmin.new
@table_fields = [:email]
@ask_admins = AskAdmin.order_by(sort)
end
def create
@ask_admins = AskAdmin.new(ask_admin_params)
@ask_admins.save
redirect_to admin_ask_admins_path
end
def edit
@ask_admin = AskAdmin.find(params[:id])
@table_fields = [:email]
@ask_admins = AskAdmin.order_by(sort)
@url = admin_ask_admin_path(@ask_admin)
end
def update
@ask_admin = AskAdmin.find(params[:id])
@ask_admin.update_attributes(ask_admin_params)
redirect_to admin_ask_admins_path
end
def destroy
@ask_admin = AskAdmin.find(params[:id])
@ask_admin.destroy
redirect_to admin_ask_admins_path
end
def ask_admin_params
params.require(:ask_admin).permit!
end
end