Skip to content
This repository was archived by the owner on Aug 16, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gems/cells/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ cell = cell(CommentCell, comment)

## File Structure

Having a cell to represent a fragment of your page is one thing. The real power, whatsoever, comes when rendering templates in cells. The `render` method does just that.
Having a cell to represent a fragment of your page is one thing. The real power, however, comes when rendering templates in cells. The `render` method does just that.

In a suffix environment, Cells expects the following file layout.

Expand Down
2 changes: 1 addition & 1 deletion gems/cells/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Let's quickly discuss what happens here in what order. After this section, you w

1. Invoking the cell in the layout via `Pro::Cell::Navigation.(nil, current_user: current_user).()` will instantiate the cell object and internally invoke the cell's default rendering method, named `show`. This method is automatically provided and simply renders the corresponding view.
2. Since the cell class name is `Pro::Cell::Navigation`, this cell will render the view `concepts/pro/view/navigation.haml`. This is following the Trailblazer naming style.
3. In the cell's view, two "helpers" are called: `signed_in?` and `avatar_url`. Whatsoever, the concept of a "helper" in Cells doesn't exist anymore. Any method or variable called in the view must be an *instance method* on the cell itself. This is why the cell class defines those two methods, and not some arbitrary helper module.
3. In the cell's view, two "helpers" are called: `signed_in?` and `avatar_url`. However, the concept of a "helper" in Cells doesn't exist anymore. Any method or variable called in the view must be an *instance method* on the cell itself. This is why the cell class defines those two methods, and not some arbitrary helper module.
4. Dependencies like the `current_user` have to get injected from the outer world when invoking the cell. Later, in the cell, those arguments can be accessed using the `options` cell method.

It is important to understand that the cell has no access to global state. You as the cell author have to define the interface and the dependencies necessary to render the cell.
Expand Down
2 changes: 1 addition & 1 deletion gems/operation/2.0/contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The `Build` macro accepts [the `:name` option](#name) to change the name from `d

## Validate

The `Contract::Validate` macro is responsible for validating the incoming params against its contract. That means you have to use `Contract::Build` beforehand, or create the contract yourself. The macro will then grab the params and throw then into the contract's `validate` (or `call`) method.
The `Contract::Validate` macro is responsible for validating the incoming params against its contract. That means you have to use `Contract::Build` beforehand, or create the contract yourself. The macro will then grab the params and throw them into the contract's `validate` (or `call`) method.

{{ "contract_test.rb:validate-only:../trailblazer/test/docs:2-0" | tsnippet }}

Expand Down
2 changes: 1 addition & 1 deletion gems/operation/2.0/representer.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ The only real difference to the above examples is that Reform will validate itse

[→ Reform's architecture docs](/gems/reform) talk about this in detail.

Reform infers this representer (or *deserializer*) automatically in `validate` and that is fine for most HTML forms where the contract schema and form layout are identical. In document APIs, whatsoever, the documents format often doesn't match 1-to-1 with the contract's schema. For example, when validating input in a JSON API system.
Reform infers this representer (or *deserializer*) automatically in `validate` and that is fine for most HTML forms where the contract schema and form layout are identical. In document APIs, however, the documents format often doesn't match 1-to-1 with the contract's schema. For example, when validating input in a JSON API system.

This is where you can specify your own representer to be used against the contract.

Expand Down
2 changes: 1 addition & 1 deletion guides/trailblazer/2.0/01-operation-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ The operation's pipe doesn't only allow you to skip steps, but also to handle er

Handling an eventual error in `how_are_you?` now becomes nothing more than adding a step on the left track, after the erroring one. This works with `failure`.

And keep in mind, there can be any number of steps on each track. You can even jump back and fourth.
And keep in mind, there can be any number of steps on each track. You can even jump back and forth.
{% endrow %}

{% callout %}
Expand Down
2 changes: 1 addition & 1 deletion guides/trailblazer/2.0/02-trailblazer-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Trailblazer tries to abstract the Reform or dry-validation internals from you, s

## Persist

When running our to-be-successful test case, whatsoever, it still breaks.
When running our to-be-successful test case, however, it still breaks.

{{ "spec/concepts/blog_post/operation/create_spec.rb:validation-fail:../trailblazer-guides/:operation-02" | tsnippet }}

Expand Down
2 changes: 1 addition & 1 deletion guides/trailblazer/2.0/03-rails-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The interesting part in the `Present` operation is the `:constant` option: it re

{{ "app/concepts/blog_post/contract/create.rb:contract:../trailblazer-guides:operation-03" | tsnippet : "present" }}

Contracts can be pure `dry-validation` schemas or Reform objects that can in turn use `dry-validation` or `ActiveModel::Validations` as their validation engine. Using a Reform object, whatsoever, will allow rendering that form in a view.
Contracts can be pure `dry-validation` schemas or Reform objects that can in turn use `dry-validation` or `ActiveModel::Validations` as their validation engine. Using a Reform object, however, will allow rendering that form in a view.

## Contract Rendering

Expand Down