我在使用回形针和 AWS gem 的 LocationsController#create 中收到以下错误AWS::Errors::MissingCredentialsError
有关异常的更多详细信息:
Missing Credentials. Unable to find AWS credentials.
You can configure your AWS credentials a few different ways:
* Call AWS.config with :access_key_id and :secret_access_key
* Export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to ENV *
Run Code Online (Sandbox Code Playgroud)
我目前正在我的机器上的开发环境中运行此代码这是development.rb
Gmaps::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# …
Run Code Online (Sandbox Code Playgroud) 尝试更新位置项后,我收到路径错误
我正在使用before_action来设置位置ID
before_action :set_location, only: [:show, :edit, :update, :destroy]
private
def set_location
@location = Location.find(params[:id])
end
Run Code Online (Sandbox Code Playgroud)
这是我的控制器我只有更新新的问题和删除工作正常
def create
@location = Location.new(location_params)
respond_to do |format|
if @location.save
format.html { redirect_to @location, notice: 'Location was successfully created.' }
format.json { render action: 'show', status: :created, location: @location }
else
format.html { render action: 'new' }
format.json { render json: @location.errors, status: :unprocessable_entity }
end
end
Run Code Online (Sandbox Code Playgroud)
结束
def update
respond_to do |format|
if @location.update(location_params)
format.html { redirect_to @location, notice: 'Location was successfully …
Run Code Online (Sandbox Code Playgroud)