Forum: Ruby on Rails Planning an application - what is the optimal MVC setup?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
952d96687009292ee0748ce3af7c10eb?d=identicon&s=25 Martin Asser Hansen (Guest)
on 2013-08-01 16:38
(Received via mailing list)
I am building a site for users where these can create a bunch of
scaffolds
and for each scaffold the user can create a bunch of tracks. Now, it
should
be possible for a user to share scaffolds with other users (this is were
I
am stuck). Same for tracks.

So the main resources are users, scaffolds and tracks and since I want
to
display an index for each of these I have chosen nested routes so in the
routes.rb file I have:

resources :users do
  resources :scaffolds do
    resources :tracks
  end
end

I have the the following models and corresponding controllers and views:

user
scaffold
track

In the models user has_many :scaffolds, scaffold has_many :tracks and
belong_to :user and track belong_to :scaffold

For the sharing I have a scaffold_relationship and a track_relationship
model both with sharing and shared attributes in which I can store
user_id
and scaffold_id/track_id. Thus I can use the has_many
:scaffold_relationships, foreign_key: "shared_id" and has_many :sharing,
through :scaffold_relationships. Same for the track_relationship.

However, I am unsure if this is the way to go. I think I want separate
scaffold and track sharing pages, and maybe it is better with separate
resources for the relationships? In any case I am stuck with planning
the
correct routes.

Help appreciated.
This topic is locked and can not be replied to.