Sha256: 25ac61f9731ffd70dc3b9dc7ca1077c3c2c156250a7284cda8f990b247294ffb
Contents?: true
Size: 676 Bytes
Versions: 1
Compression:
Stored size: 676 Bytes
Contents
class BrandsController < ApplicationController before_action :find_brand, only: [:show, :edit, :update, :destroy] def index @brands = Brand.all.order("created_at DESC") end def show end def new @brand = Brand.new end def create @brand = Brand.new(brand_params) if @brand.save redirect_to root_path else render 'new' end end def edit end def update if @brand.update(brand_params) redirect_to brand_path(@brand) else render 'edit' end end def destroy @brand.destroy redirect_to root_path end private def brand_params params.require(:brand).permit(:name) end def find_brand @brand = Brand.find(params[:id]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Depreciation-0.1.3 | app/controllers/brands_controller.rb |