effective_orders 6.7.3 → 6.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/cart.rb +1 -1
- data/app/models/effective/cart_item.rb +1 -1
- data/app/models/effective/customer.rb +1 -1
- data/app/models/effective/order.rb +1 -1
- data/app/models/effective/order_item.rb +1 -1
- data/app/models/effective/product.rb +1 -1
- data/app/models/effective/subscription.rb +1 -1
- data/config/effective_orders.rb +0 -9
- data/db/migrate/{01_create_effective_orders.rb.erb → 101_create_effective_orders.rb} +21 -33
- data/lib/effective_orders/version.rb +1 -1
- data/lib/generators/effective_orders/install_generator.rb +1 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b17d6da43052c30b3dc2e8b4ed1cb60722737444cdbc9246ebe8c1649500d9b7
|
4
|
+
data.tar.gz: 15463f7b06e80a2c4af84951338cedbc11f1f235e83daae1ca440f89d6ed6f7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74c5371ed6996eb16b848fb534da9f65671467e8c163ab6bf4802c9c8485c44782991401ba089f69db8494b3b315e6aab42f919920af1c2f1a4b5b9d2104b062
|
7
|
+
data.tar.gz: be68655d47cc0efb3ea00fce27fe750e4a5d862e0be4ebfc2e734c607cd476a3184533369410328361602e7ca4f65396ce31b890debdc290f2ea1e825e124296
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Effective
|
2
2
|
class Cart < ActiveRecord::Base
|
3
|
-
self.table_name = EffectiveOrders.carts_table_name.to_s
|
3
|
+
self.table_name = (EffectiveOrders.carts_table_name || :carts).to_s
|
4
4
|
|
5
5
|
belongs_to :user, polymorphic: true, optional: true # Optional. We want non-logged-in users to have carts too.
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Effective
|
2
2
|
class CartItem < ActiveRecord::Base
|
3
|
-
self.table_name = EffectiveOrders.cart_items_table_name.to_s
|
3
|
+
self.table_name = (EffectiveOrders.cart_items_table_name || :cart_items).to_s
|
4
4
|
|
5
5
|
belongs_to :cart, counter_cache: true
|
6
6
|
belongs_to :purchasable, polymorphic: true
|
data/config/effective_orders.rb
CHANGED
@@ -1,15 +1,6 @@
|
|
1
1
|
# EffectiveOrders Rails Engine
|
2
2
|
|
3
3
|
EffectiveOrders.setup do |config|
|
4
|
-
# Configure Database Tables
|
5
|
-
config.orders_table_name = :orders
|
6
|
-
config.order_items_table_name = :order_items
|
7
|
-
config.carts_table_name = :carts
|
8
|
-
config.cart_items_table_name = :cart_items
|
9
|
-
config.customers_table_name = :customers
|
10
|
-
config.subscriptions_table_name = :subscriptions
|
11
|
-
config.products_table_name = :products
|
12
|
-
|
13
4
|
# Layout Settings
|
14
5
|
# config.layout = { application: 'application', admin: 'admin' }
|
15
6
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class CreateEffectiveOrders < ActiveRecord::Migration[
|
2
|
-
def
|
3
|
-
create_table
|
1
|
+
class CreateEffectiveOrders < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table :orders do |t|
|
4
4
|
t.integer :user_id
|
5
5
|
t.string :user_type
|
6
6
|
|
@@ -43,10 +43,9 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
|
|
43
43
|
t.timestamps
|
44
44
|
end
|
45
45
|
|
46
|
-
add_index
|
46
|
+
add_index :orders, :user_id
|
47
47
|
|
48
|
-
|
49
|
-
create_table <%= @order_items_table_name %> do |t|
|
48
|
+
create_table :order_items do |t|
|
50
49
|
t.integer :order_id
|
51
50
|
t.string :purchasable_type
|
52
51
|
t.integer :purchasable_id
|
@@ -59,12 +58,11 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
|
|
59
58
|
t.timestamps
|
60
59
|
end
|
61
60
|
|
62
|
-
add_index
|
63
|
-
add_index
|
64
|
-
add_index
|
65
|
-
|
61
|
+
add_index :order_items, :order_id
|
62
|
+
add_index :order_items, :purchasable_id
|
63
|
+
add_index :order_items, [:purchasable_type, :purchasable_id]
|
66
64
|
|
67
|
-
create_table
|
65
|
+
create_table :carts do |t|
|
68
66
|
t.integer :user_id
|
69
67
|
t.string :user_type
|
70
68
|
|
@@ -72,9 +70,9 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
|
|
72
70
|
t.timestamps
|
73
71
|
end
|
74
72
|
|
75
|
-
add_index
|
73
|
+
add_index :carts, :user_id
|
76
74
|
|
77
|
-
create_table
|
75
|
+
create_table :cart_items do |t|
|
78
76
|
t.integer :cart_id
|
79
77
|
t.string :purchasable_type
|
80
78
|
t.integer :purchasable_id
|
@@ -85,11 +83,11 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
|
|
85
83
|
t.timestamps
|
86
84
|
end
|
87
85
|
|
88
|
-
add_index
|
89
|
-
add_index
|
90
|
-
add_index
|
86
|
+
add_index :cart_items, :cart_id
|
87
|
+
add_index :cart_items, :purchasable_id
|
88
|
+
add_index :cart_items, [:purchasable_type, :purchasable_id]
|
91
89
|
|
92
|
-
create_table
|
90
|
+
create_table :customers do |t|
|
93
91
|
t.integer :user_id
|
94
92
|
t.string :user_type
|
95
93
|
|
@@ -103,9 +101,9 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
|
|
103
101
|
t.timestamps
|
104
102
|
end
|
105
103
|
|
106
|
-
add_index
|
104
|
+
add_index :customers, :user_id
|
107
105
|
|
108
|
-
create_table
|
106
|
+
create_table :subscriptions do |t|
|
109
107
|
t.integer :customer_id
|
110
108
|
|
111
109
|
t.integer :subscribable_id
|
@@ -123,11 +121,11 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
|
|
123
121
|
t.timestamps
|
124
122
|
end
|
125
123
|
|
126
|
-
add_index
|
127
|
-
add_index
|
128
|
-
add_index
|
124
|
+
add_index :subscriptions, :customer_id
|
125
|
+
add_index :subscriptions, :subscribable_id
|
126
|
+
add_index :subscriptions, [:subscribable_type, :subscribable_id]
|
129
127
|
|
130
|
-
create_table
|
128
|
+
create_table :products do |t|
|
131
129
|
t.integer :purchased_order_id
|
132
130
|
|
133
131
|
t.string :name
|
@@ -140,14 +138,4 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
|
|
140
138
|
end
|
141
139
|
|
142
140
|
end
|
143
|
-
|
144
|
-
def self.down
|
145
|
-
drop_table <%= @orders_table_name %>
|
146
|
-
drop_table <%= @order_items_table_name %>
|
147
|
-
drop_table <%= @carts_table_name %>
|
148
|
-
drop_table <%= @cart_items_table_name %>
|
149
|
-
drop_table <%= @customers_table_name %>
|
150
|
-
drop_table <%= @subscriptions_table_name %>
|
151
|
-
drop_table <%= @products_table_name %>
|
152
|
-
end
|
153
141
|
end
|
@@ -47,15 +47,7 @@ module EffectiveOrders
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def create_migration_file
|
50
|
-
|
51
|
-
@order_items_table_name = ':' + EffectiveOrders.order_items_table_name.to_s
|
52
|
-
@carts_table_name = ':' + EffectiveOrders.carts_table_name.to_s
|
53
|
-
@cart_items_table_name = ':' + EffectiveOrders.cart_items_table_name.to_s
|
54
|
-
@customers_table_name = ':' + EffectiveOrders.customers_table_name.to_s
|
55
|
-
@subscriptions_table_name = ':' + EffectiveOrders.subscriptions_table_name.to_s
|
56
|
-
@products_table_name = ':' + EffectiveOrders.products_table_name.to_s
|
57
|
-
|
58
|
-
migration_template ('../' * 3) + 'db/migrate/01_create_effective_orders.rb.erb', 'db/migrate/create_effective_orders.rb'
|
50
|
+
migration_template ('../' * 3) + 'db/migrate/101_create_effective_orders.rb', 'db/migrate/create_effective_orders.rb'
|
59
51
|
end
|
60
52
|
|
61
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -328,7 +328,7 @@ files:
|
|
328
328
|
- config/effective_orders.rb
|
329
329
|
- config/locales/effective_orders.en.yml
|
330
330
|
- config/routes.rb
|
331
|
-
- db/migrate/
|
331
|
+
- db/migrate/101_create_effective_orders.rb
|
332
332
|
- lib/effective_orders.rb
|
333
333
|
- lib/effective_orders/engine.rb
|
334
334
|
- lib/effective_orders/version.rb
|