add new table

This commit is contained in:
Rimian Perkins 2019-12-03 13:03:10 +11:00
parent 6d71d26574
commit bdba7686d3
3 changed files with 12 additions and 2 deletions

View File

@ -5,7 +5,7 @@ module DiscoursePatrons
scope :find_user, ->(user) { find_by_user_id(user.id) } scope :find_user, ->(user) { find_by_user_id(user.id) }
class << self class << self
table_name = "discourse_patrons_customers" table_name = "discourse_subscriptions_customers"
def create_customer(user, customer) def create_customer(user, customer)
create(customer_id: customer[:id], user_id: user.id) create(customer_id: customer[:id], user_id: user.id)

View File

@ -0,0 +1,10 @@
class CreateSubscriptionsCustomers < ActiveRecord::Migration[6.0]
def change
create_table :discourse_subscriptions_customers do |t|
t.string :customer_id, null: false
t.string :product_id
t.references :user, foreign_key: true
t.timestamps
end
end
end

View File

@ -8,7 +8,7 @@ module DiscoursePatrons
let(:stripe_customer) { { id: 'cus_id4567' } } let(:stripe_customer) { { id: 'cus_id4567' } }
it "has a table name" do it "has a table name" do
expect(described_class.table_name).to eq "discourse_patrons_customers" expect(described_class.table_name).to eq "discourse_subscriptions_customers"
end end
it "creates" do it "creates" do