我有一個帶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。