Skip to content

Instantly share code, notes, and snippets.

@midu
Created October 31, 2013 17:23
Show Gist options
  • Save midu/7253606 to your computer and use it in GitHub Desktop.
Save midu/7253606 to your computer and use it in GitHub Desktop.
class Fabrice
#For Favorite & Watchlist
has_many :event_users
# option 1, tu changes ça :
has_many :events, :through => :event_users
# en :
has_many :user_events, through: :event_users, class_name: 'Event'
# et tu y accèdes via fabrice.user_events
# option 2, tu changes ça :
#Store which events one user uploaded
# option 2, tu changes ça :
has_many :events
# en :
has_many :fabrice_events, class_name: 'Event'
# et tu y accèdes via fabrice.fabrice_events
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment