Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced Patterns - Service/Action Objects: Controllers - Introduce form or action models #44

Open
Henryvw opened this issue Apr 10, 2019 · 0 comments

Comments

@Henryvw
Copy link
Owner

Henryvw commented Apr 10, 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/or models/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?

  • Look for accepts_nested_attributes - that would be a place to refactor into a form object
@Henryvw Henryvw changed the title Controllers - Introduce form or action models Advanced Patterns - Service/Action Objects: Controllers - Introduce form or action models Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant