Static selection and Ruby on Rails objects

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2010-05-22T17:58:05Z Indexed on 2010/05/22 18:00 UTC
Read the original article Hit count: 158

Hi all-

I have a simple problem, but am having trouble wrapping my head around it. I have an video object that should have one or more "genres". This list of genres should be prepopulated and then the user should just select one or more using autocomplete or some such. Here is the question:

Is it worth creating a table with genres for the static selection? Or should it just be included in the presentation layer? If there is a static table, how do we name it correctly. I envision something like this

class Video < ActiveRecord::Base
has_many :genres 
...
end

class Genre < ...
belongs_to :video
...
end

But then we get a table called genre, that basically maps all the selected genres to their parent videos. There would need to be some static table to reference the static genres. Is this the best way to do it?

Sorry if this was rambl-y a little stream of conciousness. Thanks!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about database-design