开发者

attachment_fu and RMagick

After finally getting RMagick installed on my Mac I have set up attachment_fu according to the tutorial here: http://clarkware.com/cgi/blosxom/2007/02/24#FileUploadFu&gt when I try and upload a file via the upload form I get around 80 messages like these:

/Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick.rb:44: warning: already initialized constant PercentGeometry
/Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick.rb:45: warning: already initialized constant AspectGeometry
/Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick.rb:46: warning: already initialized constant LessGeometry
/Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick.rb:47: warning: already initialized constant GreaterGeometry

I did some searching and found that this problem can arise when you require RMagick twice in an application using different casing for the require statement: http://work.rowanhick.com/2007/12/19/require-rmagick-and-case-sensitivity/ I am not requiring it myself, but I was thinking maybe with the config.gem "rmagick" line in my environment.rb file rails might be requiring it.

After the form submits it gives me a validation error of: Content type is not included in the list I have checked the source for attachement_fu and found the image/png in the list of content types so I don't believe that is the proper error message: http://github.com/technoweenie/attachment_fu/blob/master/lib/technoweenie/attachmen开发者_开发知识库t_fu.rb

Does anyone have any ideas on how I can get this to work?


If, like us you're using a gem (such as gruff) which requires rmagick as above (and thus you can't really be correcting the case of the require statements), you can configure bundler to load rmagick using the matching case.

E.g. add the following to your Gemfile:

gem 'rmagick', '2.13.1', :require => 'RMagick'

That got us out of a real pickle today.

Thanks for the original post - we were lost until we read it!


Had a similar problem with Paperclip, solved by removing config.gem 'rmagick' line from environment.rb.


Update: The following only works on the Mac. My production server choked on this. Don't use it.

I came across this problem as well. In config/environment.rb I've got:

config.gem 'rmagick'

And it has to be lowercase, otherwise Rails thinks I don't have the required gem installed.

Attachment_fu has a file called rmagick_processor.rb which has the line:

require 'RMagick'

If you change this to lowercase, "require 'rmagick'", the RMagick error messages disappear.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜