Ruby on Rails Monday, June 9, 2014

Noobie here. Let's say you have a Post, Comment, and User models. So
Post has_many comments, and User has_many comments.

If it good practice to do the following...

resources :posts do
resources :comments
end

resources :users do
resources :comments
end

etc?

I have a model in my schema that I believe I will likely have 3
different route resources for.

Or is better to just have the one, such as our first snippet of code
above, and then have a param that modifies what is returned, in this
example, passing in the user_id to just see comments for that user?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/409b245643f51f2e64338538f310cc0e%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment