ドメインてなんや
model以上でアプリケーション以下のドメインという存在であらゆる設計が一貫性が失われる
callbackでもなくFormObjectでもなくmvcで解決しきるDHHのすごさ
複数モデルをtransaction内で処理する
https://gist.github.com/dhh/9348053
https://amolnpujari.wordpress.com/2013/04/09/184/
https://qiita.com/joker1007/items/2a03500017766bdb0234
https://qiita.com/masuidrive/items/f2ae316dc8e98b4ff82a
https://amolnpujari.wordpress.com/2013/04/09/184/
https://qiita.com/kamohicokamo/items/e7c31f61c99c9fc0fe7f
https://techracho.bpsinc.jp/hachi8833/2017_11_06/47607
https://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html
https://techracho.bpsinc.jp/hachi8833/2017_12_12/48367
https://api.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html
この方針がめちゃくちゃいいような気がする
If you just need to update fields in the same model, use Callbacks. You can still do this for field updates even if you also need other patterns for more complex needs.
If you have a form with multiple models or with form-specific validation, use a Form Object. But I don’t recommend adding secondary effects to a Form Object.
If you have only few secondary effects that you use rarely, or that aren’t on the critical path, use General Decorators.
If you have secondary effects that aren’t on the critical path, and they’re always used, use Events.
If you have many secondary effects called from multiple places in different combinations, or if they’re on the critical path, use Service Objects.
If your Service Objects are getting complex or repetitive, you can have them use General Decorators or broadcast Events instead of calling secondary effects directly.
validationを複雑さなく書く
https://gist.github.com/dhh/9672827
https://gist.github.com/dhh/10649506
2つのモデルに紐づくモデルのcontrollerでの扱い
https://gist.github.com/dhh/10022098
authenticationの分割
https://gist.github.com/dhh/10880690
Gridカウントサンプル
https://gist.github.com/dhh/10882430
テストが設計を駄目にする
https://dhh.dk/2014/test-induced-design-damage.html
https://blog.cleancoder.com/uncle-bob/2014/05/01/Design-Damage.html
環境毎の設定をymlで
https://gist.github.com/dhh/9afdbfd67e3c42c9f09e
https://www.youtube.com/channel/UCdx5Dk3EWTe2i8YDA7bfl6g
youtubeよりコード例