开发者

no such file to load -- RMagick.rb Rails, Ubuntu

I have ruby and my gems installed in my home directory using rvm. 'require RMagick' works from the console and irb, but not from within my Rails app. I have the gem listed in my Gemfile.

require 'RMagick'

class PetsController < ApplicationController
  def image
    image = Image.new(image_path("base/Base.png"))
    #image = Pet.composite(0, '4a4a4a')开发者_StackOverflow
    @response.headers["Content-type"] = image.mime_type
    render :text => image.to_blob
  end

end 

If I remove the require from my controller, I get

uninitialized constant PetsController::Image

I also have tried require 'RMagick' in boot.rb, and by referring to the Image object using Magick::Image (which gives me uninitialized constant PetsController::Magick.

What am I doing wrong?


Solved it! Restarting the server fixed it. I guess I hadn't restarted the server when I added rmagick to my gemfile.


Is it possible that you are running the rails app with another user than the one that has the RMagick gem installed?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜