我不能再在我的Rails应用程序中呈现带有回形针urls的页面了。我最近更新了我的gem包。我使用的是Rails 3.2.8和Paperclip 3.1.4。我之前使用的是Paperclip2.7.0。
在我看来,失败的链接是:
ad.image.url(:medium)我的广告模型有以下声明:
Paperclip.interpolates :ad_subdomain do |attachment, style|
attachment.instance.brand.subdomain
end
has_attached_file :image,
:default_url => '/images/blank.gif',
:styles => { :medium => ["290x230>","jpg"],
:thumb => ["100x100>","jpg"] },
:storage => :file,
:path => "/mcp/ads/:style/:ad_subdomain/:basename.:extension"抛出的错误是:
TypeError: wrong argument type Class (expected Module)
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip/attachment.rb:368:in `extend'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip/attachment.rb:368:in `initialize_storage'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip/attachment.rb:80:in `initialize'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip/instance_methods.rb:5:in `new'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip/instance_methods.rb:5:in `attachment_for'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/paperclip-3.1.4/lib/paperclip.rb:191:in `block in has_attached_file'发布于 2012-08-22 01:47:54
出于某种原因,我有:
:storage => :file在我的声明中。这是行不通的。如果你想使用文件系统,你只需要完全省略存储行,它将是缺省的。
发布于 2012-08-22 01:26:33
请查看Paperclip github页面上列出的要求:
回形针现在需要Ruby1.9.2版本和Rails版本>= 3.0 (仅当您要将回形针与Rails一起使用时)。
如果你仍然使用Ruby 1.8.7或Ruby on Rails 2.3.x,你仍然可以在你的项目中使用Paperclip2.7.x。此外,本自述文件中的所有内容可能并不适用于您的回形针版本,您应该阅读2.7版的自述文件。
https://stackoverflow.com/questions/12059939
复制相似问题