jQueryコンテンツカルーセルを含む都市ページがあります。カルーセルのコンテンツは、各ループによってファイルされます。
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は、ロードされる添付ファイル(画像)に基づいて動的であるため、配置できません。