Trailblazer v2.0.0 Release Notes
-
All old semantics will be available via trailblazer-compat.
- ✂ Removed
Operation::run
as it was a bad decision. Raising an exception on invalid is a very test-specific scenario and shouldn't have been handled in the core doce. - ✂ Removed
Operation::present
, since you can simply callOperation::new
(without builders) orOperation::build_operation
(with builders). - ✂ Removed
Operation::valid?
. This is in the result object viaresult.success?
. - ✂ Removed
Operation#errors
. This is in the result object viaresult[:errors]
if the operation was invalid. Removed the private option
:raise_on_invalid
. UseContract::Raise
instead, if you need it in tests.✂ Removed
Operation::contract
(without args). Please useOperation::["contract.default.class"]
.✂ Removed
Operation::callbacks
(without args). Please useOperation::["callback.<name>.class"]
.✂ Removed
Operation::contract_class
. Please useOperation::["contract.default.class"]
.✂ Removed
Operation::contract_class=
. Please useOperation::["contract.default.class"]=
. Doesn't inherit.
Model
- The
model
method doesn't exist anymore, useself["model"]
or write your own. :find_by
diverts to left track.:create
is:new
now.
🏗 Builder
- 🏗 It's
include Builder
now, notextend Builder
. - 🏗
builds
now receives one options hash.
Policy
- 👻 No exception anymore, but
Operation#["policy.result"]
. - Access the current user via
self["current_user"]
now. - 💅
Policy
isPolicy::Pundit
now asPolicy
is Trailblazer's (upcoming) authorization style.
Representer
- ✂ Removed
Operation::representer_class
. Please useOperation::["representer.class"]
. - ✂ Removed
Operation::representer_class=
. Please useOperation::["representer.class"]=
. - 📜 You can now have any number of named representers:
Operation.representer :parser, ParsingRepresenter
. - Automatic infering of the representer from a
contract
is not so automatic anymore. This feature was barely used and is now available viainclude Representer::InferFromContract
. - 👍 Reform 2.0 is not supported in
Representer
anymore, meaning you can't automatically infer representers from 2.0 contracts. Reform 2.0 works with all remaining components. - ✂ Removed
Operation::contract_class
. Please useOperation::["contract.default.class"]
. - ✂ Removed
Operation::contract_class=
. Please useOperation::["contract.default.class"]=
. Doesn't inherit.
Callback
- ✂ Removed
Operation::Dispatch
, it's calledOperation::Callback
.
Collection
- ✂ Removed
Operation::Collection
. Please useOperation::present
.
Controller
- ✂ Removed
Controller
, this is now in trailblazer-rails.
Contract
- 0️⃣ You can't call
Create.().contract
anymore. The contract instance(s) are available through theResult
object via["contract.default"]
. - ✂ Removed the deprecation for
validate
, signature is(params[, model, options, contract_class])
. - ✂ Removed the deprecation for
contract
, signature is([model, options, contract_class])
.
- ✂ Removed