It sounds like you’re creating what’s often called a “form object”. You may find these articles helpful:
- Decomposing Fat ActiveRecord Models - 3 Form Objects
- ActiveModel Form Objects
- Form Objects: notes from a thoughtbot dev discussion
There’s also a Weekly Iteration Video on the topic of form objects.
Is there a clean way of doing the following that doesn’t require a method call?
I’m not sure what you’re asking here? You want to avoid calling persist!
manually and would prefer just to call save
? If so, the example in the Code Climate blog post should have you covered.