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

21 lines
519 B
Ruby

class Admin::AdImagesController < ApplicationController
def index
@ad_images = AdImage.all
end
def new
@ad_image = AdImage.new
end
def create
@ad_image = AdImage.new(ad_image_params)
@ad_image.save
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, title_translations: [:en, :zh_tw], context_translations: [:en, :zh_tw])
end
end