# -*- encoding : utf-8 -*- class Admin::MailHistsController < ApplicationController layout "admin" before_action :auth_admin before_action :admin_space def admin_space @admin_space = "stocks" end def index @mail_hists = MailHist.all @mail_hists = sort_by_sorting(@mail_hists, "created_at DESC") params[:search][:per_page] = params[:search][:per_page] || 50 per_page = params[:search][:per_page] page = (params[:page] and params[:page] != "") ? params[:page] : 1 @mail_hists = @mail_hists.page(page).per(per_page) end def show @mail_hist = MailHist.find(params[:id]) end def new @mail_hist = MailHist.new end def edit @mail_hist = MailHist.find(params[:id]) end def create @mail_hist = MailHist.new(params.require(:mail_hist).permit!) if @mail_hist.save else render action: "new" end end def update @mail_hist = MailHist.find(params[:id]) if @mail_hist.update_attributes(params.require(:mail_hist).permit!) else render action: "edit" end end def destroy @mail_hist = MailHist.find(params[:id]) @mail_hist.destroy end end