All Versions
Latest Version
Avg Release Cycle
65 days
Latest Release

Changelog History
Page 3

  • v2.0.0 Changes

    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 call Operation::new (without builders) or Operation::build_operation (with builders).
    • ✂ Removed Operation::valid?. This is in the result object via result.success?.
    • ✂ Removed Operation#errors. This is in the result object via result[:errors] if the operation was invalid.
    • Removed the private option :raise_on_invalid. Use Contract::Raise instead, if you need it in tests.

    • ✂ Removed Operation::contract (without args). Please use Operation::["contract.default.class"].

    • ✂ Removed Operation::callbacks (without args). Please use Operation::["callback.<name>.class"].

    • ✂ Removed Operation::contract_class. Please use Operation::["contract.default.class"].

    • ✂ Removed Operation::contract_class=. Please use Operation::["contract.default.class"]=. Doesn't inherit.


    • The model method doesn't exist anymore, use self["model"] or write your own.
    • :find_by diverts to left track.
    • :create is :new now.

    🏗 Builder

    • 🏗 It's include Builder now, not extend Builder.
    • 🏗 builds now receives one options hash.


    • 👻 No exception anymore, but Operation#["policy.result"].
    • Access the current user via self["current_user"] now.
    • 💅 Policy is Policy::Pundit now as Policy is Trailblazer's (upcoming) authorization style.


    • ✂ Removed Operation::representer_class. Please use Operation::["representer.class"].
    • ✂ Removed Operation::representer_class=. Please use Operation::["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 via include 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 use Operation::["contract.default.class"].
    • ✂ Removed Operation::contract_class=. Please use Operation::["contract.default.class"]=. Doesn't inherit.


    • ✂ Removed Operation::Dispatch, it's called Operation::Callback.


    • ✂ Removed Operation::Collection. Please use Operation::present.



    • 0️⃣ You can't call Create.().contract anymore. The contract instance(s) are available through the Result 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]).
  • v2.0.0.rc2 Changes

    • It's now Contract::Persist( name: "params" ) instead of ( name: "contract.params" ).
  • v2.0.0.rc1 Changes

    • 🚚 consider got removed since step now evaluates the step's result and deviates (or not).
  • v2.0.0.beta3 Changes

    • 🆕 New, very slick keyword arguments for steps.
  • v2.0.0.beta2 Changes

    • ✂ Removed Operation::Controller.
    • 📇 Renamed Persist to Contract::Persist.
    • Simplify inheritance by introducing Operation::override.
    • Contract paths are now consistent.
  • v2.0.0.beta1 Changes

    • Still undefined self.~.
  • v1.1.2 Changes

    • Stricter uber dependency.
  • v1.1.1 Changes

    • 📇 Rename Operation::Representer::ClassMethods to Operation::Representer::DSL and allow to use DSL and Rendering without Deserialization so you can use two different representers.
    • Policy::Guard::policy now also accepts a Callable object.
    • ➕ Add Operation#model=.
  • v1.1.0 Changes

    • 0️⃣ Representer#represented defaults to model now, not to contract anymore.
    • The only way to let Trailblazer pass a document to the operation is via is_document: true. There is no guessing anymore based on whether or not Representer is mixed into the operation or not.
    • ➕ Add Operation#params! that works exactly like #model!: return another params hash here if you want to change the params structure while avoiding modifying the original one.
    • ➕ Add Controller#params! that works exactly like Operation#params! and allows returning an arbitrary params object in the controller. Thanks to @davidpelaez for inspiration.
    • 🗄 Deprecate Dispatch in favor of Callback. In operations, please include Operation::Callback. Also, introduced Operation#callback! which aliases to #dispatch!. Goal is having to think less, and now all naming is in line.

    🛠 Fixes

    • Representer#to_json now allows passing options.
    • 🛠 The :params key never got propagated to prepopulate! when using Controller#form. This is now fixed.
  • v1.0.4 Changes

    • 🛠 Fix Controller#run, which now returns the operation instance instead of the Else object.