Guest User

Untitled

a guest
Jul 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. class User < ActiveRecord::Base
  2. has_many :authentications
  3. has_many :attendees
  4. has_many :distances
  5. has_many :events, :through => :distances
  6. has_many :events, :through => :attendees
  7. has_many :events
  8. belongs_to :role
  9. has_many :comments
  10. end
  11.  
  12. class Event < ActiveRecord::Base
  13. has_event_calendar :start_at_field => 'start', :end_at_field => 'end'
  14. has_many :distances
  15. has_many :users, :through => :distances
  16. belongs_to :user
  17. belongs_to :event_type
  18. has_many :attendees
  19. has_many :users, :through => :attendees
  20. has_many :comments
  21. end
  22.  
  23.  
  24. class Attendee < ActiveRecord::Base
  25. belongs_to :user
  26. belongs_to :event
  27. validates_uniqueness_of :user_id, :scope => :event_id
  28. end
Add Comment
Please, Sign In to add comment