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

29 lines
550 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
@banner = Banner.new
end
def create
@banner = Banner.new(banner_params)
@banner.save
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