【发布时间】:2010-07-06 21:49:34
【问题描述】:
我在其他帖子中看到过几次这样的问题,但似乎没有一个答案适用。
环境: 导轨 3 来自 jugend 的 amazon/ecs gem。唯一的文件在这里: http://github.com/jugend/amazon-ecs/blob/master/lib/amazon/ecs.rb
我的 gemfile 有: gem 'amazon-ecs', :git => 'git://github.com/jugend/amazon-ecs.git'
一切都在 irb 中工作。我可以跑: 捆绑控制台 需要 'amazon/ecs' 然后去城里
当我尝试从控制器中使用它时,就像这样: 需要'amazon/ecs'
require 'amazon/ecs'
class SearchController < ApplicationController
def index
end
def results
Amazon::Ecs.configure do |options|
options[:aWS_access_key_id] = '[key]'
options[:aWS_secret_key] = '[secret]'
end
res = Amazon::Ecs.item_search(params[:search], {:response_group => 'Medium', :search_index => 'All'})
end
end
我在第 8 行得到:未初始化的常量 SearchController::Amazon,我第一次尝试使用 Amazon。
ecs.rb 有一个包含类 Ecs 的 Amazon 模块。我不确定为什么这在 erb 中有效,而不是在 rails 中。
我对 Rails 还是有点陌生,所以请用小词儿回答。 :-/
【问题讨论】:
标签: ruby ruby-on-rails-3 bundler