Hi there,
I got 2 controllers : Products & ProductReviews. When they are
nested, it looks ugly:
/products/:product_id/product_reviews
I want it looks better :
/products/:product_id/reviews
So i wrote this route, but not helper path are available
(product_new_product_review...) :
map.resources :products,
:collection => {...},
:has_many => [...] do |products|
products.resources :reviews, :controller =>
'product_reviews', :name_prefix => 'product_'
end
because in DB, we made choice to separate reviews in distinct table
product_reviews, user_reviews... my controllers are like my db.
So i solve this problem by doing it :
I’ll re-iterate the point one last time: Using types on your table and specifying the type as “Product” or “User” will eliminate a lot of the stress you’re going to run into later on when you try to alter something for all reviews. Having just the ONE review controller for every type of review is BEST PRACTICE and is much easier to maintain than having (from what I can see), 4 controllers and 4 models.
ok, i'll remember your advice. my db admin choose this solution
(separate tables) because the tables are supposed to become really big
in production (i don't remember his arguments... but sometime
denormalize could be good). and the other point is that there is table
inheritance it was simple to do it like it (even if there is already
inheritance in my models). regards and thanks for you interest.
I take fine care of my language, more so than other purveyors of it who tend to massacre it.
I was simply noting that if your database administration thinks that having multiple tables that he is insane. My basis for this belief has already been stated clearly, I think.
Chimpanzees are fairly cheap and will work for food scraps.