Sha256: a427869338b5a060ee2fc032298a7d68b346b9cc37c90e40a9f7b9ed8868456a
Contents?: true
Size: 1.07 KB
Versions: 32
Compression:
Stored size: 1.07 KB
Contents
class ::IshManager::IroStrategiesController < IshManager::ApplicationController def create @strategy = Iro::CoveredCallStrategy.new params[:iro_strategy].permit! @strategy.iro_purse_id = Iro::Purse.where( user_id: current_user.id ).first.id authorize! :create, @strategy flag = @strategy.save if flag flash[:notice] = 'Success.' redirect_to my_purse_path else flash[:alert] = "No luck: #{@strategy.full_errors.messages.join(', ')}." render action: 'new' end end def edit @strategy = Iro::CoveredCallStrategy.find params[:id] authorize! :edit, @strategy end def new @strategy = Iro::CoveredCallStrategy.new authorize! :new, @strategy end def update @strategy = Iro::CoveredCallStrategy.find params[:id] authorize! :update, @strategy flag = @strategy.update params[:iro_strategy].permit! if flag flash[:notice] = 'Success.' redirect_to my_purse_path else flash[:alert] = "No luck: #{@strategy.full_errors.messages.join(', ')}." render action: 'new' end end end
Version data entries
32 entries across 32 versions & 1 rubygems