Skip to content

Instantly share code, notes, and snippets.

@TheAlchemistKE
Created October 1, 2020 15:15
Show Gist options
  • Save TheAlchemistKE/6cc8b7e799f3960abd010e93e8f877ac to your computer and use it in GitHub Desktop.
Save TheAlchemistKE/6cc8b7e799f3960abd010e93e8f877ac to your computer and use it in GitHub Desktop.
class User < ApplicationRecord
has_secure_password
has_many :created_events, foreign_key: :creator_id, class_name: 'Event'
has_many :user_events, foreign_key: :attendee_id
has_many :events_attended, through: :user_events, dependent: :delete_all, source: :event_attended
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment