23 lines
595 B
Ruby
23 lines
595 B
Ruby
class Admin::AdImagesController < ApplicationController
|
|
def index
|
|
@ad_images = AdImage.all
|
|
end
|
|
|
|
def new
|
|
@ad_image = AdImage.new
|
|
@ad_banners = Banner.all
|
|
end
|
|
|
|
def create
|
|
@ad_image = AdImage.new(ad_image_params)
|
|
@ad_image.save
|
|
redirect_to admin_ad_images_path
|
|
end
|
|
|
|
private
|
|
|
|
# Never trust parameters from the scary internet, only allow the white list through.
|
|
def ad_image_params
|
|
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])
|
|
end
|
|
end |