Trailblazer v0.3.0 Release Notes

  • ๐Ÿ”„ Changes

    • In Railtie, use ActionDispatch::Reloader.to_prepare for autoloading, nothing else. This should fix spring reloading.
    • ๐Ÿ‘ Allow Op#validate(params, model, Contract) with CRUD.
    • ๐Ÿ‘ Allows prefixed table names, e.g. admin.users in Controller. The instance variables will be @user. Thanks to @fernandes and especially @HuckyDucky.
    • โž• Added Operation::Collection which will allow additional behavior like pagination and scoping. Thanks to @fernandes for his work on this.
    • โž• Added Operation::collection to run setup! without instantiating a contract. This is called in the new Controller#collection method.
    • โž• Added Operation#model as this is a fundamental concept now.
    • ๐Ÿ‘Œ Improved the undocumented Representer module which allows inferring representers from contract, using them to deserialize documents for the form, and rendering documents.
    • ๐Ÿ”„ Changed Operation::Dispatch which now provides imperative callbacks.

    API change

    1. The return value of #process is no longer returned from ::run and ::call. They always return the operation instance.
    2. The return value of #validate is true or false. This allows a more intuitive operation body.

      def process(params)
        if validate(params)
          .. do valid
        else
          .. handle invalid
        end
      end
      
    • ๐Ÿ‘ท Worker only works with Reform >= 2.0.0.