Hello!
I’m developing online game (Heroes fighting against Clans) and i’m
planning next structure of my app: i’ve got top-level resources Heroes
(profiles of supermembers) and Clans (profiles of groups of members). So
i’ve got both HeroesController and ClansController.
What i wanna do is give Heroes and Clans’ leaders opportunities to add
“Content Resources” to their profile area or to the clan area,
respectively. “Content Resources” is different singular resources such
as Gallery, Blog, Shop and others. So Gallery has many Photoalbums (that
have many Photos), Blog has many Posts, Shop has goods and so on.
Hero can turn on/off each of singular Content Resources, and after that
he get its full functionallity on his own profile page
The same thing with Clans - clan leader can connect in settings area for
example Forum.
So the question is how to organize this structure well. I think about
that way:
/controllers
HeroesController
ClansController
/blog/
Blog::BlogsController
Blog::PostsController
/gallery/
Gallery::GalleriesController
Gallery::PhotoalbumsController
Gallery::PhotosController
/models
Hero
Clan
module Blog
/blog/
Blog::Blog
Blog::Post
module Gallery
/gallery/
Gallery::Gallery
Gallery::Photoalbums
Gallery::Photos
And routes:
resources :clans do
scope :module => ‘blog’ do
resource :blog do
resources :posts
end
end
scope :module => 'gallery' do
resource :gallery do
resources :photoalbums
resources :photos
end
end
end
resources :heroes do
… the same things…
end
And here i’ve got a first problem - when i run
/clan/1/blog/posts and even /clan/1/blog/posts/1/edit it all goes quite
well,
but it fails in simple /clan/1/blog saying: [No route matches
{:action=>“show”, :controller=>“clubs”}]
May be i’m doing everything wrong. May be i should choose another way
instead of nested resources and/or namespaces.
I’m new in Rails, and i’m sorry for maybe easy questions
Grateful for any help, suggestions and advises!
Thank you!