Sha256: a1d70d1d219cde904b14d2badd374feef89f35e00c31df477dbf8ad04f243f10
Contents?: true
Size: 702 Bytes
Versions: 2
Compression:
Stored size: 702 Bytes
Contents
class Todos::CompletedController::Create < 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: todo_id) unless todo return view_builder.build(Defaults::ForbiddenView) unless current_ability.can?(:update, todo) todo.done = true if todo.save view_builder.build(Todos::IndexRedirect) else view_builder.build(Defaults::ServerErrorView, errors: ["Unable to mark todo completed"]) end end private def todo @todo ||= Todo.where(id: todo_id).first end def todo_id params[:todo_id] 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/completed_controller/create.rb |
aldous-1.1.2 | examples/basic_todo/app/controller_actions/todos/completed_controller/create.rb |