I like to nest my view folders the same way as my resources. So, if I have: map.resources :foos do |foos| foos.resources :bars end map.resources :sums Then I''ll structure my view folders like: views/ foos/ bars/ sum/ To make this work, I need a tiny little extra line of code in the nested controller to tell rails where to look for the templates. Specifically: prepend_view_path "app/views/foos" Just curious about people''s views on this. Any feedback/criticisms on this method? Thanks, ~ Mark -- Posted via http://www.ruby-forum.com/.
It''s an aesthetic decision, so...y''know, do what you want, but it''s not necessary since you''re introducing complexity in having to maintain a bunch of of prepend_view_path lines everywhere. http://en.wikipedia.org/wiki/Convention_over_configuration On Sep 10, 9:22 pm, Mark Dodwell <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I like to nest my view folders the same way as my resources. > > So, if I have: > > map.resources :foos do |foos| > foos.resources :bars > end > map.resources :sums > > Then I''ll structure my view folders like: > > views/ > foos/ > bars/ > sum/ > > To make this work, I need a tiny little extra line of code in the nested > controller to tell rails where to look for the templates. Specifically: > > prepend_view_path "app/views/foos" > > Just curious about people''s views on this. Any feedback/criticisms on > this method? > > Thanks, > > ~ Mark > -- > Posted viahttp://www.ruby-forum.com/.
Thanks Eric -- the more I think about this, I''m thinking it''s *not* a good idea actually... -- Posted via http://www.ruby-forum.com/.
Not to mention the confusion when you start nesting a resource under more than one parent; eg, you have foos/1/bars and woots/1/bars. --Matt Jones On Sep 11, 1:45 am, Eric <ericgh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> It''s an aesthetic decision, so...y''know, do what you want, but it''s > not necessary since you''re introducing complexity in having to > maintain a bunch of of prepend_view_path lines everywhere. > > http://en.wikipedia.org/wiki/Convention_over_configuration > > On Sep 10, 9:22 pm, Mark Dodwell <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > > > I like to nest my view folders the same way as my resources. > > > So, if I have: > > > map.resources :foos do |foos| > > foos.resources :bars > > end > > map.resources :sums > > > Then I''ll structure my view folders like: > > > views/ > > foos/ > > bars/ > > sum/ > > > To make this work, I need a tiny little extra line of code in the nested > > controller to tell rails where to look for the templates. Specifically: > > > prepend_view_path "app/views/foos" > > > Just curious about people''s views on this. Any feedback/criticisms on > > this method? > > > Thanks, > > > ~ Mark > > -- > > Posted viahttp://www.ruby-forum.com/.