Err0rZero

Results 9 comments of Err0rZero

试过了,还是这样

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

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

进不去,端口也没起

![image](https://user-images.githubusercontent.com/11703373/27572689-fa2ec38a-5b3f-11e7-84c1-ff1dd4dcc128.png) 就这样,什么也没提示。

我已经启动了,不好意思,没看到,还有个问题,json数据怎么导入?

我没有找到文档能让爬虫抓取下来的json数据存入数据库中,特像您请教下。谢谢

![image](https://user-images.githubusercontent.com/11703373/27592390-f3128040-5b86-11e7-9dfb-bfe18227734a.png) 出现了这个。。。

这个我已经改好了,估计是网页改过结构了,所以抓取到的数据和你的格式不一样造成了 ``` file = File.read('db/housedata.json') file.gsub(/\{(.*?)\}/).each do |line| hash=JSON.parse(line) house=House.new house.area=hash['area'][0].scan(/[0-9]/).join.to_i house.url=hash['url'][0] #print hash['price'][0].scan(/[0-9]/).join.to_i house.average_price=(hash['price'][0].scan(/[0-9]/).join.to_i * 10000) / hash['area'][0].scan(/[0-9]/).join.to_i #hash['average_price'][0].scan(/[0-9]/).join.to_i house.floor=hash['floor'][0] house.build_time=hash['build_time'][0].scan(/[0-9]/).join #print hash['location'][0].delete(' ').scan(/\n(.*?)\n/).join.gsub("\u00A0", "") house.community=hash['location'][0].delete(' ').scan(/\n(.*?)\n/).join.gsub("\u00A0", "") house.street=hash['location'][0].delete('...