[英]Image using paperclip
使用Rails 2.3.15
和paperclip 2.3.0
顯示圖像很容易如下:
@product.img_url.url
現在,我已經在兩個表上進行了聯接,根據聯接的結果,我想獲取並顯示圖像。
例如
@searchItems = Product.find(:all, :select => "p.id, p.title, p.img_url, p.img_url_file_name, p.img_url_content_type, p.img_url_file_size, p.url, pp.selling_price",
:conditions => "p.category = 'Mobiles'",
:joins => "as p inner join product_pricings as pp on p.id = pp.product_id")
searchItems
是一個array
。 我如何從array
獲取圖像,就像我從模型中獲取圖像一樣。
任何幫助都會對我有很大幫助。
是不是
@searchItems.each do |product|
do_something_with(product.img_url.url)
end
你是什么意思?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.