You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create classes that basically manage the forms, put all the logic there instead of in the views. These also have the advantage of being able to write unit tests.
The app doesn't really need this stuff right now, but where can I use it to practice these patterns?
Look for accepts_nested_attributes - that would be a place to refactor into a form object
The text was updated successfully, but these errors were encountered:
Henryvw
changed the title
Controllers - Introduce form or action models
Advanced Patterns - Service/Action Objects: Controllers - Introduce form or action models
Jul 8, 2019
Create "action objects" also called "service objects"... if the
save
method gets really complicated.Google / research "form objects", "action objects", "service objects", "repository pattern"
Create folder structure:
models/forms/
models/views/
models/actions/
ormodels/services/
Create classes that basically manage the forms, put all the logic there instead of in the views. These also have the advantage of being able to write unit tests.
The app doesn't really need this stuff right now, but where can I use it to practice these patterns?
accepts_nested_attributes
- that would be a place to refactor into a form objectThe text was updated successfully, but these errors were encountered: