Sha256: f6a3c562d4310ffecd77b09111982aa706ec9eacc03c483db8deb7bf96b1b83f
Contents?: true
Size: 871 Bytes
Versions: 110
Compression:
Stored size: 871 Bytes
Contents
class IshManager::CoTailorsController < IshManager::ApplicationController def home authorize! :home, ::CoTailors @products = ::CoTailors::Product.all end def create_product authorize! :create, ::CoTailors::Product @product = ::CoTailors::Product.new params[:co_tailors_product].permit! if @product.save flash[:notice] = 'Created product' else flash[:alert] = 'Cannot create product: ', @product.errors.messages.to_s end redirect_to :action => 'home' end def update_product @product = ::CoTailors::Product.find params[:id] authorize! :update, @product if @product.update_attributes params[:co_tailors_product].permit! flash[:notice] = 'updated product' else flash[:alert] = 'Cannot update product: ', @product.errors.messages.to_s end redirect_to :action => 'home' end end
Version data entries
110 entries across 110 versions & 1 rubygems