class Admin::QuotesController < Admin::AdminController before_action :set_section def index @quotes = Quote.published.order(id: :desc).paginate(page: params[:page], per_page: 20) end def pending @quotes = Quote.pending.order(id: :desc).paginate(page: params[:page], per_page: 20) end def accept @quote = Quote.find(params[:id]) @quote.state = :published @quote.save! flash.notice = "Quote successfully accepted." redirect_to pending_admin_quotes_url end def destroy @quote = Quote.find(params[:id]) @quote.destroy! flash.notice = "Quote successfully rejected." redirect_to pending_admin_quotes_url end private def set_section @section = "quotes" end end