module PsAdmin # Dashboard class HomeController < ApplicationController before_action :authenticate_admin! layout 'admin' def index @admin = current_admin pp_pages_get end def change_pass @admin = current_admin pp_pages_get if params[:admin][:password].blank? params[:admin].delete(:password) params[:admin].delete(:password_confirmation) end if @admin.update(admin_params) bypass_sign_in(@admin) redirect_to action: 'index' else render 'index' end end def pp_pages_get @published_pages = PublishedPage.where('type_of = 1 OR type_of = 2').order('priority ASC') @pp = PublishedPage.where('type_of = 1 OR type_of = 2').order('number_of_views DESC').first @sc_setting = ScSetting.first end private def admin_params params.require(:admin).permit(:description, :password, :password_confirmation) end end end