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.411 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.410 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.409 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.408 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.407 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.406 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.405 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.404 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.403 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.402 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.401 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.400 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.399 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.397 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.396 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.395 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.394 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.393 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.392 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.391 app/controllers/ish_manager/iro_strategies_controller.rb