On Tuesday, June 10, 2014 1:56:34 PM UTC-4, Ruby-Forum.com User wrote:
>
> mike2r wrote in post #1149390: 
> > IMO, it can be done either way.  If you use routes, it would be a little 
> > cleaner when you are using the same resource more than once to make a 
> > concern: 
> > 
> > concern :commentable do 
> >    resources :comments 
> > end 
> > 
> > resources :posts, concerns: [:commentable] 
> > resources :users, concerns: [:commentable] 
>
> When doing this, does this mean both of these resources would access the 
> same controller? How can I have them access different controllers, and 
> what would a proper naming convention be for each controller in your 
> example? 
>
> -- 
> Posted via http://www.ruby-forum.com/. 
>

If you're referring to the comments resource, yes, both would post to the 
same controller in your format as well as the one I suggested.  If you want 
them to point to different controllers, you will need to go back to your 
original format and specify a controller, such as:

resources posts do
   resources comments, controller: "postcomment"
end


-- 
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+unsubscr...@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/7f872c99-57a0-431d-9da8-da66ce41858f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to