adbanner-test/app/controllers/admin/ad_images_controller.rb

23 lines
595 B
Ruby
Raw Normal View History

2014-04-11 07:47:33 +00:00
class Admin::AdImagesController < ApplicationController
def index
@ad_images = AdImage.all
end
def new
@ad_image = AdImage.new
2014-04-11 08:26:34 +00:00
@ad_banners = Banner.all
2014-04-11 07:47:33 +00:00
end
def create
@ad_image = AdImage.new(ad_image_params)
@ad_image.save
2014-04-11 08:26:34 +00:00
redirect_to admin_ad_images_path
2014-04-11 07:47:33 +00:00
end
private
# Never trust parameters from the scary internet, only allow the white list through.
def ad_image_params
2014-04-11 08:26:34 +00:00
params.require(:ad_image).permit(:weight, :out_link, :link_open, :file, :file_cache, :banner_id, title_translations: [:en, :zh_tw], context_translations: [:en, :zh_tw])
2014-04-11 07:47:33 +00:00
end
end