diff --git a/app/controllers/admin/ad_images_controller.rb b/app/controllers/admin/ad_images_controller.rb index 2571fcaa..75523624 100644 --- a/app/controllers/admin/ad_images_controller.rb +++ b/app/controllers/admin/ad_images_controller.rb @@ -22,8 +22,10 @@ class Admin::AdImagesController < Admin::AdBannersController end def update - @ad_image = AdImage.find(params[:id]) + @ad_banner = AdBanner.find params[:ad_banner][:id] + @ad_image = AdImage.find(params[:ad_image][:id]) @ad_image.update_attributes(params[:ad_image]) + @ad_banner.ad_images << @ad_image redirect_to admin_ad_images_path end @@ -38,10 +40,10 @@ class Admin::AdImagesController < Admin::AdBannersController end def create - # @ad_banner = AdBanner.find params[:ad_banner][:id] + @ad_banner = AdBanner.find params[:ad_banner][:id] @ad_image = AdImage.new params[:ad_image] - #@ad_image.to_save = true - #@ad_banner.ad_images << ad_image + @ad_image.to_save = true + @ad_banner.ad_images << @ad_image if @ad_image.save redirect_to admin_ad_images_path diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index a65f06af..f28b1b90 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -55,7 +55,7 @@