discourse/plugins
Loïc Guitaut fc1c5f6a8d DEV: Have contract take a block in services
Currently in services, the `contract` step is only used to define where
the contract will be called in the execution flow. Then, a `Contract`
class has to be defined with validations in it.

This patch allows the `contract` step to take a block containing
validations, attributes, etc. directly. No need to then open a
`Contract` class later in the service.

It also has a nice side effect, as it’s now easy to define multiples
contracts inside the same service. Before, we had the `class_name:`
option, but it wasn’t really useful as you had to redefine a complete
new contract class.
Now, when using a name for the contract other than `default`, a new
contract will be created automatically using the provided name.

Example:
```ruby
contract(:user) do
  attribute :user_id, :integer

  validates :user_id, presence: true
end
```
This will create a `UserContract` class and use it, also putting the
resulting contract in `context[:user_contract]`.
2024-10-02 17:00:01 +09:00
..
automation Update translations 2024-10-02 08:55:44 +02:00
chat DEV: Have contract take a block in services 2024-10-02 17:00:01 +09:00
checklist DEV: remap all core icons for fontawesome 6 upgrade (#28715) 2024-09-13 16:50:52 +01:00
discourse-details FIX: allow quote-less details BBCode 2024-06-24 14:16:36 +02:00
discourse-lazy-videos Update translations (#28577) 2024-08-29 15:37:52 -04:00
discourse-local-dates Update translations 2024-10-02 08:55:44 +02:00
discourse-narrative-bot Update translations 2024-10-02 08:55:44 +02:00
discourse-presence FEATURE: Support designating multiple groups as mods on category (#28655) 2024-09-04 04:38:46 +03:00
footnote DEV: remap all core icons for fontawesome 6 upgrade (#28715) 2024-09-13 16:50:52 +01:00
poll Update translations 2024-10-02 08:55:44 +02:00
spoiler-alert Update translations 2024-10-02 08:55:44 +02:00
styleguide Update translations 2024-10-02 08:55:44 +02:00