Hi guys. Impressive work with mutations
Typical usecase for Command is
outcome = UserSignup.run(params)
if outcome.success?
user = outcome.result
else
render outcome.errors
end
...and what we may notice, is the only reason for having boolean attribute success? is to write if for it,
and the only reason to have outcome variable is to call success? on it
UserSignup
.run(params)
.on_success { |outcome| @user = outcome.user }
.on_failure { |outcome| render outcome.errors }
And by using call method syntactical sugar we may get even sexier stuff
UserSignup.(params)
.on_success { |outcome| @user = outcome.user }
.on_failure { |outcome| render outcome.errors }
This success procs thing may be in parallel with usual success?
What do you think?
Hi guys. Impressive work with
mutationsTypical usecase for Command is
...and what we may notice, is the only reason for having boolean attribute
success?is to writeiffor it,and the only reason to have
outcomevariable is to callsuccess?on itAnd by using
callmethod syntactical sugar we may get even sexier stuffThis
success procsthing may be in parallel with usualsuccess?What do you think?