Sha256: 8ea7615d88c4feda155705183d5c3fa27cfc9f232eea50120e2ea13440160f1e

Contents?: true

Size: 415 Bytes

Versions: 2

Compression:

Stored size: 415 Bytes

Contents

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

    if todos.destroy_all
      build_view(Todos::IndexRedirect)
    else
      build_view(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.0.1 examples/basic_todo/app/controller_actions/todos/all_completed_controller/destroy.rb
aldous-1.0.0 examples/basic_todo/app/controller_actions/todos/all_completed_controller/destroy.rb