Skip to content

Needless deep nesting

Richard Huang edited this page Aug 15, 2010 · 3 revisions

Please go to http://rails-bestpractices.com/posts/11-needless-deep-nesting

Before:


map.resources :posts do |post|
  post.resources :comments do |comment|
    comment.resources :favorites
  end
end

After:


map.resources :post do |post|
  post.resources :comments
end

map.resources :comments do |comment|
  comment.resources :favorites
end