I have a city page with a jQuery content carousel. The content of the carousel is filed by a each loop.
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
Activities and sights models are the same
City view content slider:
@hot.each do |a|
a.attachments.each do |a|
= image_tag(a.file.url, :height =>"325px", :width =>"650px" ), url_path
I want to generate links (url_path) in my each loop...how can I realize this? It cannot place the url_path of the routes because they are dymanic based on which attachment (image) is loaded.