Sha256: a9f3023d4e2cf81652a9bae391c12b819b04c59d10b978f3ed9d2535e8fe0fc0
Contents?: true
Size: 942 Bytes
Versions: 5
Compression:
Stored size: 942 Bytes
Contents
module Admin class Market::CategoriesController < BaseController handle_return_path PER_PAGE = 20 def index @categories = ::Market::Category.order('category_id DESC, position').paginate(page: params[:page], per_page: PER_PAGE) end def new @category = ::Market::Category.new end def create @category = ::Market::Category.new(params[:market_category].permit!) if @category.save redirect_to_back else render :new end end def edit @category = ::Market::Category.find(params[:id]) end def update @category = ::Market::Category.find(params[:id]) if @category.update_attributes(params[:market_category].permit!) redirect_to_back else render :edit end end def destroy @category = ::Market::Category.find(params[:id]) @category.destroy redirect_to_back end end end
Version data entries
5 entries across 5 versions & 1 rubygems