PENGZhaoqing / HousePricing

HousePricing旨在提供房价的可视化预测,帮助用户更好的评估房产和预测未来的价格(dev)
https://house-pricing.herokuapp.com/
409 stars 181 forks source link

抓取周边信息,没有权限 #7

Open Err0rZero opened 7 years ago

Err0rZero commented 7 years ago

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

PENGZhaoqing commented 7 years ago

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

Err0rZero commented 7 years ago

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

PENGZhaoqing commented 7 years ago

在每个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
Err0rZero commented 7 years ago

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

PENGZhaoqing commented 7 years ago

房屋的坐标整合没