Hi. I am currently developing a small course system for student and
teachers. The system is divided in sections and sections have many
messages, comments, documents and schedules. Pretty easy to set up
using ROR, just add some belongs_to and has_many relations. But
everything becomes much more complicated when the section items
(message, comment and so on...) all has comments. And they can also be
a favorite to a users favorite list and much more. Basically all the
items has some shared generic stuff that I just don't want to copy
around. Let's check my rest routes so everyone understands better:
map.resources :sections do |sections|
sections.resources :messages
sections.resources :documents
sections.resources :schedules
end
map.resources :items do |item|
item.resources :comments
item.resources :favorites
end
I would basically want to have a generic resource (Item) that takes
care of comments, favorites and so on. And that is what my question is
all about. Is it a good way to inherit from a base class called Items
using STI? Or could I solve this problem some other way? If I don't
have a base class I would have to nest the comment resources to each
of the items and that's not a good solution either.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---