I'm looking to build an application that will allow multiple users to create their own tables, populate those tables with fields and 'contestants'.
I'm trying to piggyback off of the work I did following the rails tutorial (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book) and so am using the user model as created there.
My current thought is to have the following layout:
**User**
- ID
- Name
- Email
- Password
- Created at
- Updated at
- has_many(tables)
**Table**
- ID
- belongs_to (user) through (user.id)
- Title
- Field 1 (string)
- Field 2 (string)
- Field ... (string)
- Field 10 (string)
- has_many(contestants)
**Contestant**
- ID
- belongs_to (table) through (table.id)
- Name
- Field 1 value
- Field 2 value
- Field ... value
- Field 10 value
However, it seems messy that I manually populate (and have to limit) the number of fields and I don't really know how I'm going to account for users that want to create tables with fewer fields.
Also, I'm not sure of the inheritance of the contestant model on the titles (and types) of the field value i.e. sometimes the field will want to be an int, sometimes a string.
Am I going about this the right way or is there a better structure or some Ruby/Railisms that I'm not taking advantage of?