I have been reading up on some rails stuff and one thing I never came across is an example of what the controller or the view pages of a rich join model looks like.
Is it general practice not to have a controller/view pages off of those models?
Does anyone have any code example of the controller/view for a rich join?
edit: defining rich join.
Model A
has_many :model_c
has_many :model_b, :through => model_c
Model B
has_many :model_c
has_many :model_a, :through => model_c
Model C
belongs_to :model_a
belongs_to :model_b
I am curious to see how the controller of model C looks like given it's a join model between model A and B. For example, when you need to create a new Model C page, how do you retrieve and store the values for model_a.id and model_b.id so that it's all connected.
Ok, so I can give you my personal opinion of this and that is "it depends". :)
I've seen projects where there is a full scaffold for the join-model, and I've seen projects where there's none. Generally the difference is in how important the join-model is. if there's only, like, one or two extra columns on it - and they're generally only displayed on, say, the user's profile page, then don't bother. But if the join-model really is richly decorated... well it's really a whole model in its own right - and deserves a full scaffolding to cover that.
Sometimes there's a full scaffolding but only from certain perspectives.
A good example of the latter might be where you have models A&B be "user" and "service" and model C as "subscriptions".
In some situations, users can only see a list of services, and a list of their own subscriptions to them... and a service could only see a list of subscribed users... and admins could see all of them.
so... it depends :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With