Skip to content

Instantly share code, notes, and snippets.

@ream88
Created January 22, 2012 19:54
Show Gist options
  • Save ream88/1658495 to your computer and use it in GitHub Desktop.
Save ream88/1658495 to your computer and use it in GitHub Desktop.
How to separate cc and bcc in messages?
class Chat < ActiveRecord::Base
has_many :user_chats, conditions: { bbc: false }
has_many :bbc_user_chats, class_name: 'UserChat', conditions: { bbc: true }
has_many :users, through: :user_chats
has_many :bbc_users, through: :bbc_user_chats, source: :user
end
class User < ActiveRecord::Base
has_many :user_chats
has_many :chats, through: :user_chats
end
class UserChat < ActiveRecord::Base
belongs_to :user
belongs_to :chat
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment