discourse-subscriptions/app/models/discourse_subscriptions/customer.rb

16 lines
370 B
Ruby
Raw Normal View History

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