Rails 5 google-places gem error

时间:2017-02-11 12:11:23

标签: ruby-on-rails google-places

我在rails 5上安装了'google_places' gem但无法使其正常工作。当我运行此代码段时:

driver.execute_script('document.getElementById("Irealpass").setAttribute("value","myPassword");')

它出现了这样的错误:

@client = GooglePlaces::Client.new(Rails.application.secrets.places_api_key)

我的控制员:

 uninitialized constant PlacesController::GooglePlaces

我没解决,感谢你的帮助。

编辑:

我的错。我不小心建了google-places gem

1 个答案:

答案 0 :(得分:0)

需要这样做

class PlacesController < ApplicationController
  require 'google-places'
  before_action :set_place, only: [:show, :edit, :update, :destroy]

  # GET /places
  # GET /places.json
  def index
    @places = Place.all
  end