Sha256: 4270f7a77b12ad639158ed3acd57b0b940c61b380b865a61a13c7eabac28a0af
Contents?: true
Size: 524 Bytes
Versions: 2
Compression:
Stored size: 524 Bytes
Contents
class TodosController::Destroy < BaseAction def default_view_data super.merge({todo: todo}) end def perform return view_builder.build(Home::ShowRedirect) unless current_user return view_builder.build(Todos::NotFoundView, todo_id: params[:id]) unless todo return view_builder.build(Defaults::ForbiddenView) unless current_ability.can?(:destroy, todo) todo.destroy view_builder.build(Todos::IndexRedirect) end private def todo @todo ||= Todo.where(id: params[:id]).first 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_controller/destroy.rb |
aldous-1.1.2 | examples/basic_todo/app/controller_actions/todos_controller/destroy.rb |