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

30 lines
578 B
Ruby

class Admin::AdBannersController < ApplicationController
def index
@ad_banners = Banner.all
end
def show
@ad_banners = Banner.all
@active = Banner.find(params[:id])
render :action => 'index'
end
def new
@ad_banner = Banner.new
end
def create
@ad_banner = Banner.new(banner_params)
@ad_banner.save
render "index"
end
private
# Never trust parameters from the scary internet, only allow the white list through.
def banner_params
params.require(:banner).permit(:ad_fx, :height, :speed, :title, :timeout, :width)
end
end