23 lines
		
	
	
		
			709 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			709 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # == Schema Information
 | |
| #
 | |
| # Table name: tip_sources
 | |
| #
 | |
| #  id                 :uuid             not null, primary key
 | |
| #  tipster_account_id :string
 | |
| #  description        :string
 | |
| #  source_type        :string
 | |
| #  active             :boolean          default(FALSE)
 | |
| #  filters            :jsonb
 | |
| #  created_at         :datetime         not null
 | |
| #  updated_at         :datetime         not null
 | |
| #
 | |
| class TipSource < ApplicationRecord
 | |
|   belongs_to :tipster_account, dependent: :delete
 | |
|   has_many :source_subscriptions, dependent: :delete_all
 | |
|   has_many :tip_source_data, class_name: 'TipSourceData'
 | |
|   has_many :subscription_runs, through: :source_subscriptions
 | |
| 
 | |
|   scope :active_sources, -> { where(active: true)}
 | |
| 
 | |
| end
 |