Skip to content

Instantly share code, notes, and snippets.

@danielsousaio
Created November 8, 2017 01:50
Show Gist options
  • Save danielsousaio/5dfe2fc2047603164ba33b833cecc1ec to your computer and use it in GitHub Desktop.
Save danielsousaio/5dfe2fc2047603164ba33b833cecc1ec to your computer and use it in GitHub Desktop.
Ethnicity and Users
# models/concerns/ethnicitable.rb
require 'active_support/concern'
module Ethnicitable
extend ActiveSupport::Concern
included do
has_and_belongs_to_many :ethnicities
end
end
# models/user.rb
class User < ApplicationRecord
...
include Ethnicitable
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment