I am experiencing something that has to be fairly common in the rails
world, but I haven’t found a clean solution yet.
I have a SignupController that handles multiple models in a single
Those models are User, UserProfile, CreditCard, Subscription, and
When the form is filled out and posted, I want to do exactly what I
would do if the form was only for a single model:
(1) Build the object from params[:model]
(2) Save the object, rendering errors to the form page if they exists
(otherwise flash ‘Success’).
Why is this so tough when dealing with multiple models? Here is what
am doing (and this is how I know it’s too complicated and there must
a better way):
(1) Building each object (@user = User.new(params[:user]), @cc =
(2) Parked at Loopia
(3) I haven’t gotten to manually building an ‘errors’ hash yet.
I would love to hear some feedback.