Em 05-08-2012 13:10, Gabriel Sobrinho escreveu:
Rodrigo,
This approach seems very interesting but I have one question.
What you do if user create a company and do not fill the partners
(i.e.: go to other screen before filling the partners) and use that
company on the system?
I can't know the details about your specific applications ;)
So you're saying that a company is only valid if it has at least one
partner, right?
I don't know how "other screens" are reached. Suppose you have a button
"Next". It could be disabled until your company has at least one partner.
Other than that you can create an scope "with_partners" or even a
default one that will filter companies containing partners only. To get
better performance I'd recommend creating the company with an
"incomplete" database field set to true. Then, each time you add/remove
partners you'd update the field accordingly in an after_save hook for
instance.
Would that work for you?
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.