app/controllers/static_pages_controller.rb
# call this method first to make sure only admin can perform the action
call this method first to make sure only admin can perform the action
call this method first to make sure only admin can perform the action
def authenticate_user
    if !session[:user_id]
      redirect_to login_path
    end
  end
def authenticate_user if ! session [ :user_id ] redirect_to login_path end end
call this method first to make sure only admin can perform the action
call this method first to make sure only admin can perform the action