0
对我的图像使用回形针。嵌套属性paperclip
型号:
class Country < ActiveRecord::Base
has_many :regions
has_many :assets, :dependent => :destroy
accepts_nested_attributes_for :assets
end
class Asset < ActiveRecord::Base
belongs_to :country
has_attached_file :image,
:styles => {
:thumb=> "100x100>",
:small => "300x300>",
:large => "600x600>"
}
end
我国的index.html看起来是这样的:
countries.each do |country|
country.name
我尝试这样做:
link_to(image_tag(country.asset.image.url(:thumb)), country.asset.image.url(:original))
但我得到一个错误。
有人的想法,我做错了什么?
什么错误? ...? – fl00r