开发者

RMagick + Rails + Heroku?

开发者 https://www.devze.com 2022-12-25 07:58 出处:网络
I\'m trying to figur开发者_StackOverflow中文版e out how to get rmagick on my app, and then make it work on Heroku?For Rails3, you have to add this specification:

I'm trying to figur开发者_StackOverflow中文版e out how to get rmagick on my app, and then make it work on Heroku?


For Rails3, you have to add this specification:

gem "rmagick", "2.12.0", :require => 'RMagick'

Note: require is CAsE SeNSITIvE


Ok so for future reference heres what needs to be done.

In your .gems file you need:

rmagick

and then in your config/environment.rb file you need:

config.gem "rmagick",
:lib => "RMagick" 

Because its already preinstalled with heroku - this does the trick.


Once I did the following from capps answer.

gem "rmagick", "2.12.0", :require => 'RMagick'

Then I added the require statement to any file uses rmagick it fixed my issue.

require 'RMagick'

This worked on Heroku cedar stack running rails 3.1


It depends on which stack you are using on Heroku. The default Aspen stack includes a lot of gems preloaded. For compatibility reasons, the newer Bamboo stack has no preinstalled gems. It is always better to define your gem dependencies in the .gems manifest or in the new bundler style Gemfile.

More info:
Stacks: http://docs.heroku.com/stack
Gems: http://docs.heroku.com/gems


You should just need to add a require statement in whatever class. It's case sensitive!

mike@sleepycat:~/projects/myapp$ heroku console --app myapp
Ruby console for myapp.heroku.com
>> require 'RMagick'
=> []
>> include Magick
=> Object

I don't have that in my .gems file or anything, and there it is in my console, so it seems that it is just there by default.


I know this post is quite old but I just ran into this myself.

gem 'rmagick', '2.16.0', :require => 'rmagick'

Worked for me. According to my Heroku logs RMagick is deprecated in favor of rmagick (all lower case).

Hope this helps the future Googler.

0

精彩评论

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

关注公众号