ask/app/controllers/admin/ask_admins_controller.rb

46 lines
910 B
Ruby
Raw Normal View History

2014-10-02 06:00:35 +00:00
# encoding: utf-8
class Admin::AskAdminsController < OrbitAdminController
def initialize
super
2016-11-07 07:40:22 +00:00
@app_title = 'ask'
2014-10-02 06:00:35 +00:00
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