我有一个带jQuery内容轮播的城市页面。传送带的内容由每个循环提交。每个循环中的动态url_path
CityController
@events = @city.events.find_all_by_hot(true)
@activities = @city.activities.find_all_by_hot(true)
@sights = @city.sights.find_all_by_hot(true)
@hot = @events + @activities + @sights
Class city
has_many: events
end
class events
belongs_to :city
has_many :attachments, :as => :attachable
accepts_nested_attributes_for :attachments
end
活动和景点车型是相同的
City view content slider:
@hot.each do |a|
a.attachments.each do |a|
= image_tag(a.file.url, :height =>"325px", :width =>"650px"), url_path
我要生成在我的每个循环链接(url_path)...我怎么能认识到这一点?它不能放置路径的url_path,因为它们是基于哪个附件(图像)加载的dymanic。