Sha256: 54c2c16fdadcc784dd1c49e6af5fdfeab5a1174b40f7c2fc0099b747e9634629

Contents?: true

Size: 439 Bytes

Versions: 2

Compression:

Stored size: 439 Bytes

Contents

class Todos::AllCompletedController::Destroy < BaseAction
  def perform
    return view_builder.build(Home::ShowRedirect) unless current_user

    if todos.destroy_all
      view_builder.build(Todos::IndexRedirect)
    else
      view_builder.build(Defaults::ServerErrorView, errors: ['Unable to delete completed todos'])
    end
  end

  private

  def todos
    @todo ||= Todo.where(user_id: current_user.id).where(done: true)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aldous-1.1.3 examples/basic_todo/app/controller_actions/todos/all_completed_controller/destroy.rb
aldous-1.1.2 examples/basic_todo/app/controller_actions/todos/all_completed_controller/destroy.rb