Commit 319449c8 by Xuan Trung Le

fix bugs: admin can apply or favorite job

parent 48aecf01
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :clear_session_candidate
helper_method :clear_session_candidate, :admin_can_not_do_this
def clear_session_candidate
session[:candidate] = {}
......@@ -14,4 +14,11 @@ class ApplicationController < ActionController::Base
super
end
end
def admin_can_not_do_this
if current_admin
flash[:notice] = "Admin can't do this"
redirect_back(fallback_location: root_path)
end
end
end
class AppliesController < ApplicationController
before_action :admin_can_not_do_this
before_action :authenticate_user!
def apply
session[:job_id] = params[:job_id] if params[:job_id]
......
class FavoritesController < ApplicationController
before_action :admin_can_not_do_this
before_action :authenticate_user!
def index
@jobs = current_user.liked_jobs.includes(:company)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment