HousePricing icon indicating copy to clipboard operation
HousePricing copied to clipboard

抓取周边信息,没有权限

Open Err0rZero opened this issue 7 years ago • 5 comments

抓取周边信息,提取没有权限,这是为何?

Err0rZero avatar Jun 28 '17 03:06 Err0rZero

先登录,用seed.rb里的账号密码

PENGZhaoqing avatar Jun 28 '17 12:06 PENGZhaoqing

登陆了,还是显示没有权限

Err0rZero avatar Jun 28 '17 13:06 Err0rZero

在每个app/controllers/xx_controller.rb中,通过before_action来判断当前用户是否存在(已登录),若未登录成功,则不会让其抓取,强制返回主页,你看是不是这里出了问题,你这边可以取消这个限制

class HospitalsController < ApplicationController

  before_action :login, only: [:ajax]  
  ...
  private

  def login
    if current_user.nil?
      redirect_to root_path, flash: {:warning => "只有管理员能进行此操作喔"}
    end
  end

end

PENGZhaoqing avatar Jun 29 '17 03:06 PENGZhaoqing

NoMethodError (undefined method buses_houses' for nil:NilClass): app/controllers/buses_controller.rb:10:in ajax'

Err0rZero avatar Jun 29 '17 15:06 Err0rZero

房屋的坐标整合没

PENGZhaoqing avatar Jun 30 '17 09:06 PENGZhaoqing