Sha256: 464d2ef6861f1d303554f7b566cef42836307ac7366cb0206efac26252d5644b
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
require_dependency "banner_lite/application_controller" module BannerLite class BannersController < ApplicationController before_action :set_banner, only: [:show, :edit, :update, :destroy] def index @banners = Banner.all end def show end def new @banner = Banner.new end def edit end def create @banner = Banner.new(banner_params) if @banner.save redirect_to @banner, notice: 'Banner was successfully created.' else render action: 'new' end end def update if @banner.update(banner_params) redirect_to @banner, notice: 'Banner was successfully updated.' else render action: 'edit' end end def destroy @banner.destroy redirect_to banners_url, notice: 'Banner was successfully destroyed.' end private def set_banner @banner = Banner.find(params[:id]) end def banner_params params.require(:banner).permit(:url, :file, :active_from, :active_until) end end end
Version data entries
3 entries across 3 versions & 1 rubygems