borutus 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99c7e9b6c1428c39c6419f3899b8274f16529da5c764393c04212b322510ce32
4
- data.tar.gz: be8481eb09396b05a8ec1c16333ed98458d76b64af964394a62705e33595ecea
3
+ metadata.gz: 16856f6ab2672e5bba5fc033897e834fe2dabfdd3ce617ef1ff62dceba442ad5
4
+ data.tar.gz: 209c8d788c4d19c266b0fe48ff518818642d1b2763b7b2046ab87ce497a75671
5
5
  SHA512:
6
- metadata.gz: fa81c5a98f4dcaa9d94b644bdc6af9e29ba2dd3cc219b68b4dbe69e74de96a65f7b92991173a44b31290c3966a4a3ed10265a4ca9787a88d39ffda15358c7f34
7
- data.tar.gz: 6261072d1a25213b31d16a6a9e99b33d4c6279e8b9ca6e271fc410df85771ad45322acef1fa4790a2700e70cfb7134b71916144ff7ac3eac8d1331ad0ebae97a
6
+ metadata.gz: c07ecc181ecc05d2307c61617a5b37676031769bd28b115604a2acc0d4fd530a47a973536c8c2bb88f481dd596e7fcf0cc4e0f1b22f96851435ccf24c75a2e1b
7
+ data.tar.gz: d7ec5648852dcf209f9eb91a5cde85c4f84bbb06579022e1d7b1a6afcf66e38359f7687151c544173f02ce60a7f84af13dc32b76bad36c1630b7dcc1095e8093
@@ -72,7 +72,7 @@ module Borutus
72
72
  validates_presence_of :type
73
73
 
74
74
  scope :with_amounts, -> do
75
- where("borutus_amounts_count > 0")
75
+ where("amounts_count > 0")
76
76
  end
77
77
 
78
78
  def self.types
@@ -12,7 +12,7 @@ module Borutus
12
12
  belongs_to :entry, class_name: "Borutus::Entry"
13
13
  belongs_to(:account, {
14
14
  class_name: "Borutus::Account",
15
- counter_cache: :borutus_amounts_count,
15
+ counter_cache: true,
16
16
  })
17
17
 
18
18
  validates_presence_of :type, :amount, :entry, :account
@@ -4,7 +4,8 @@ class AddBorutusAmountCounterCache < ActiveRecord::Migration[4.2]
4
4
  add_column :borutus_accounts, :borutus_amounts_count, :integer
5
5
 
6
6
  Borutus::Account.all.pluck(:id).each do |id|
7
- Borutus::Account.reset_counters(id, :borutus_amounts)
7
+ Borutus::Account.reset_counters(id, :debit_amounts)
8
+ Borutus::Account.reset_counters(id, :credit_amounts)
8
9
  end
9
10
  end
10
11
 
@@ -0,0 +1,16 @@
1
+ class ChangeBorutusAmountCountColumn < ActiveRecord::Migration[4.2]
2
+
3
+ def up
4
+ remove_column :borutus_accounts, :borutus_amounts_count
5
+ add_column :borutus_accounts, :amounts_count, :integer
6
+
7
+ Borutus::Account.all.pluck(:id).each do |id|
8
+ Borutus::Account.reset_counters(id, :amounts)
9
+ end
10
+ end
11
+
12
+ def down
13
+ remove_column :borutus_accounts, :amounts_count
14
+ end
15
+
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Borutus
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -217,9 +217,9 @@ module Borutus
217
217
  )
218
218
  purchase.save
219
219
 
220
- expect(equity.amounts.size).to eq 1
221
- expect(asset.amounts.size).to eq 2
222
- expect(expense.amounts.size).to eq 1
220
+ expect(equity.reload.amounts.size).to eq 1
221
+ expect(asset.reload.amounts.size).to eq 2
222
+ expect(expense.reload.amounts.size).to eq 1
223
223
  end
224
224
  end
225
225
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: borutus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-10-25 00:00:00.000000000 Z
12
+ date: 2019-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails
@@ -170,6 +170,7 @@ files:
170
170
  - config/session_store.rb
171
171
  - db/migrate/20160422010135_create_borutus_tables.rb
172
172
  - db/migrate/20191025095830_add_borutus_amount_counter_cache.rb
173
+ - db/migrate/20191025154652_change_borutus_amount_count_column.rb
173
174
  - lib/borutus.rb
174
175
  - lib/borutus/engine.rb
175
176
  - lib/borutus/version.rb