# -*- encoding : utf-8 -*- class Admin::SBrandsController < ApplicationController layout "admin" before_action :auth_admin before_action :admin_space def admin_space @admin_space = "stocks" end def index @s_brands = SBrand.order(:name).all end def show @s_brand = SBrand.find(params[:id]) end def new @s_brand = SBrand.new end def edit @s_brand = SBrand.find(params[:id]) end def create @s_brand = SBrand.new(params.require(:s_brand).permit!) if @s_brand.save else render action: "new" end end def update @s_brand = SBrand.find(params[:id]) if @s_brand.update_attributes(params.require(:s_brand).permit!) else render action: "edit" end end def destroy @s_brand = SBrand.find(params[:id]) @s_brand.destroy end end