RMagick + Rails + Heroku?

别来无恙 提交于 2019-12-03 04:22:49

问题


I'm trying to figure out how to get rmagick on my app, and then make it work on Heroku?


回答1:


For Rails3, you have to add this specification:

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

Note: require is CAsE SeNSITIvE




回答2:


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.




回答3:


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




回答4:


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




回答5:


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.




回答6:


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.



来源:https://stackoverflow.com/questions/2572934/rmagick-rails-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!