16 lines
370 B
Ruby
Raw Normal View History

2019-10-26 11:31:19 +11:00
# frozen_string_literal: true
2019-12-04 11:23:45 +11:00
module DiscourseSubscriptions
2019-10-26 11:31:19 +11:00
class Customer < ActiveRecord::Base
2019-12-03 13:29:47 +11:00
self.table_name = "discourse_subscriptions_customers"
2019-10-26 13:01:49 +11:00
2019-12-03 13:29:47 +11:00
scope :find_user, ->(user) { find_by_user_id(user.id) }
2019-10-26 13:01:49 +11:00
has_many :subscriptions
2019-12-03 13:29:47 +11:00
def self.create_customer(user, customer)
create(customer_id: customer[:id], user_id: user.id)
2019-10-26 13:01:49 +11:00
end
2019-10-26 11:31:19 +11:00
end
end