RMagick + Rails + Heroku?

后端 未结 6 762
滥情空心
滥情空心 2021-01-31 05:46

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

相关标签:
6条回答
  • 2021-01-31 06:33

    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 讨论(0)
  • 2021-01-31 06:34

    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.

    0 讨论(0)
  • 2021-01-31 06:39

    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

    0 讨论(0)
  • 2021-01-31 06:42

    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.

    0 讨论(0)
  • 2021-01-31 06:45

    For Rails3, you have to add this specification:

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

    Note: require is CAsE SeNSITIvE

    0 讨论(0)
  • 2021-01-31 06:46

    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

    0 讨论(0)
提交回复
热议问题