How-to guides
A guide takes one task, walks it in three to five steps and points to the reference for details. If you are new, do the tutorial first and return when a specific problem comes up.
Structs (field_struct)
Section titled “Structs (field_struct)”- Validate request params: turn untrusted params into a typed struct and report what is wrong
- Use camelCase JSON keys: keep snake_case in Ruby and match an outside API
- Keep secrets out of logs: mask passwords and tokens in
inspectandpp - Dates, times and zones: parse dates and local times the same way on every machine
- Nested structs and arrays: find which element is wrong
- Add your own type: read a value the built-in types don’t
Actions (actionable)
Section titled “Actions (actionable)”- Declare and handle outcomes: name the ways an action ends and branch on each
- Compose actions: use one action as a step of another
- Run in a background job: retry by failure code
- Use ActiveRecord transactions: roll back on failure, send effects after the commit
- Test with RSpec: test an outcome in one line
- Generate RBS signatures: types for Steep or Solargraph
- Lint with the RuboCop cop: catch a
failthat does not stop the run
After an option or a method? That is the reference. Curious why something works the way it does? Read the explanation pages.
FieldStruct, Actionable and their adapters are open source under the MIT license.