I can’t understand what the difference is between a namespace and a scope in the routing of ruby-on-rails 3.
Could someone please explain?
namespace "admin" do
resources :posts, :comments
end
scope :module => "admin" do
resources :posts, :comments
end
The difference lies in the paths generated.
The paths are
admin_posts_pathandadmin_comments_pathfor the namespace, while they are justposts_pathandcomments_pathfor the scope.You can get the same result as a namespace by passing the
:name_prefixoption to scope.