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

Version Path
ish_manager-0.1.8.390 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.389 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.388 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.387 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.386 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.385 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.384 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.383 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.382 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.381 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.380 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.379 app/controllers/ish_manager/iro_strategies_controller.rb