2011-10-03 53 views
0

我有紅寶石和我的寶石安裝在我的家目錄使用rvm。 '需要RMagick'可以在控制檯和irb上運行,但不能在我的Rails應用程序中運行。我有我的Gemfile中列出的寶石。沒有這樣的文件加載 - RMagick.rb Rails,Ubuntu

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

我在做什麼錯?

回答

0

有沒有可能是你與其他用戶比一個運行軌道的應用程序,哈哈安裝了寶石RMagick

+0

我使用WEBrick服務器進行開發,它與我一樣運行。 –

+0

嘗試在文件頂部添加'require'rubygems'',看看是否不能解決問題 –

1

解決了!重新啓動服務器修復它。我猜我沒有重新啓動服務器,當我添加rmagick到我的gemfile。

相關問題