diff --git a/app/controllers/ad_banners_controller.rb b/app/controllers/ad_banners_controller.rb index 6fc34fb..08fdca7 100644 --- a/app/controllers/ad_banners_controller.rb +++ b/app/controllers/ad_banners_controller.rb @@ -1,7 +1,7 @@ class AdBannersController < ApplicationController def widget adbanner = Banner.find(OrbitHelper.widget_custom_value) - images = adbanner.ad_images.can_display.collect.with_index do |b,i| + images = adbanner.ad_images.can_display.desc(:created_at).collect.with_index do |b,i| image_link = OrbitHelper.is_mobile_view ? b.file.mobile.url : b.file.url klass = i == 0 ? "active" : "" caption = i == 0 ? '
' : "" diff --git a/app/views/admin/ad_banners/_index.html.erb b/app/views/admin/ad_banners/_index.html.erb index 6f41a91..a1631ec 100644 --- a/app/views/admin/ad_banners/_index.html.erb +++ b/app/views/admin/ad_banners/_index.html.erb @@ -222,7 +222,7 @@ data-cycle-timeout="<%= banner.timeout.to_i*1000 %>" > <% if !banner.ad_images.can_display.blank? %> - <% banner.ad_images.can_display.each do |image| %> + <% banner.ad_images.can_display.desc(:created_at).each do |image| %> <% end %> <% else %> @@ -283,7 +283,7 @@ <%= t("ad.new_image") %> - <% banner.ad_images.each_with_index do |image,idx| %> + <% banner.ad_images.desc(:created_at).each_with_index do |image,idx| %>