Reputation: 2093
I have a couple of namespaces which look identical, the only difference between the two are the names. So I have
namespace :narrow do
resources :posts
resources :comments
...
...
end
namespace :wide do
resources :posts
resources :comments
...
...
end
What I would like to do is have the same resources defined in each namespace without needing to make changes in two places when resources are added/removed/changed.
Is there any way to do this?
Upvotes: 4
Views: 191
Reputation: 2224
Isn't this just a ruby file? couldn't you do:
[:narrow, :wide].each do |ns|
namespace ns do
resources :posts
resources :comments
end
end
Upvotes: 5