【发布时间】:2011-10-03 05:59:28
【问题描述】:
我使用 rvm 在我的主目录中安装了 ruby 和我的 gem。 'require RMagick' 可以在控制台和 irb 中使用,但不能在我的 Rails 应用程序中使用。我的 Gemfile 中列出了 gem。
require 'RMagick'
class PetsController < ApplicationController
def image
image = Image.new(image_path("base/Base.png"))
#image = Pet.composite(0, '4a4a4a')
@response.headers["Content-type"] = image.mime_type
render :text => image.to_blob
end
end
如果我从控制器中删除要求,我会得到
uninitialized constant PetsController::Image
我也尝试过在 boot.rb 中使用 require 'RMagick',并使用 Magick::Image 引用 Image 对象(这给了我 uninitialized constant PetsController::Magick。
我做错了什么?
【问题讨论】:
标签: ruby-on-rails ubuntu gem rvm rmagick