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

30 lines
578 B
Ruby
Raw Normal View History

2014-04-11 07:47:33 +00:00
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
2014-04-11 08:26:34 +00:00
@ad_banner = Banner.new
2014-04-11 07:47:33 +00:00
end
def create
2014-04-11 08:26:34 +00:00
@ad_banner = Banner.new(banner_params)
@ad_banner.save
render "index"
2014-04-11 07:47:33 +00:00
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