Created
June 13, 2012 20:18
-
-
Save paav-o/2926262 to your computer and use it in GitHub Desktop.
Nakkikoneen datamalliluonnos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # app/models/event.rb | |
| class Event < ActiveRecord::Base | |
| field :name, :type => String # "Maailmanlopun reivit" | |
| field :date, :type => Date # "2012-12-21" | |
| field :description, :type => String # "Osallistumalla nakkiin pääset maksutta bileisiin..." | |
| has_many :tasks | |
| end | |
| # app/models/task.rb | |
| class Task < ActiveRecord::Base | |
| field :name, :type => String # "Lipunmyynti" | |
| field :description, :type => String # "Tässä nakissa myydään lippuja." | |
| field :available_hours, :type => Array # [22, 23, 00, 01, 02, 03] | |
| belongs_to :event | |
| has_many :reservations, :dependent => true | |
| has_many :volunteers, :through => :reservations | |
| end | |
| # app/models/reservation.rb | |
| class Reservation < ActiveRecord::Base | |
| field :hour, :type => Integer # 23 | |
| belongs_to :task | |
| belongs_to :volunteer | |
| end | |
| # app/models/volunteer.rb | |
| class Volunteer < ActiveRecord::Base | |
| field :name, :type => String # "Erkki Esimerkki" | |
| field :email, :type => String # "erkki.esimerkki@aalto.fi" | |
| field :phone, :type => String # "0401234567" | |
| field :will_construct, :type => Boolean | |
| field :will_deconstruct, :type => Boolean | |
| has_many :reservations, :dependent => true | |
| has_many :tasks, :through => :reservations | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment