deleted_at 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b044ffad6653348c6202362b5894d01311dc3e16
4
- data.tar.gz: d3f41c1fe35254b1b779d351330376a91ff0919a
3
+ metadata.gz: bc6d9d446fa6477a7eb22388a7a668a0f4871d79
4
+ data.tar.gz: de7b054ea2f46a01753866b88d84bc8184e449f1
5
5
  SHA512:
6
- metadata.gz: ec94212c15a7538dfcde0a22ea4320944fc42d6332aae8b8bc5f850fd5f91a79694829eac276b4693167c88d52ccf4d400fec75011b2a073ce9d8beafe68938c
7
- data.tar.gz: 0df63d894dcb07be2a8f460fd8b898b4cdbcd0f32d14d5f221fad52ebe40fe71019fcfe2eb104422ae396723b745d3ea7f2c7721ba9fd8c48b7e0919f1ab0d5a
6
+ metadata.gz: 9915eebda6fc0c1309f201b5b88f77f65b8e898cd21a1053c3afb75bcd9ae3169b5c6e3fcdada8cafb7fb2c9518602aef847d1124576bf1c2864dcf0d95455d1
7
+ data.tar.gz: 6bcfda4d08f1f875d783b2958c2e63260e2dd9c91a30693a3f5c46b7465fe2b86cc0ddc488159da3def7ca0571a4c8bbd17ca37c308ab2668ea83da413cc8e5f
@@ -7,7 +7,7 @@ module DeletedAt
7
7
  extend ActiveSupport::Concern
8
8
 
9
9
  included do
10
- class_attribute :deleted_at_column,
10
+ class_attribute :deleted_at_column, :original_table_name,
11
11
  :deleted_by_column, :deleted_by_class, :deleted_by_primary_key
12
12
 
13
13
  class << self
@@ -25,12 +25,6 @@ module DeletedAt
25
25
 
26
26
  parse_options(options)
27
27
 
28
- # Just gotta ask for it once, so the class knows it before inheritence
29
- # NOTE: This needs to happen regardless of whether the views have been installed
30
- # yet or not. This is because to install the views, this needs to have been done!
31
- primary_key = self.primary_key
32
- table_name = self.table_name
33
-
34
28
  unless ::DeletedAt::Views.all_table_exists?(self) && ::DeletedAt::Views.deleted_view_exists?(self)
35
29
  return warn("You're trying to use `with_deleted_at` on #{name} but you have not installed the views, yet.")
36
30
  end
@@ -47,6 +41,17 @@ module DeletedAt
47
41
  BBB
48
42
  end
49
43
 
44
+
45
+ # We are confident at this point that the tables and views have been setup.
46
+ # We need to do a bit of wizardy by setting the table name to the actual table
47
+ # (at this point: model/all), such that the model has all the information
48
+ # regarding its structure and intended behavior. Calling primary_key loads the
49
+ # table data into the class.
50
+ self.original_table_name = self.table_name
51
+ self.table_name = ::DeletedAt::Views.all_table(self)
52
+ primary_key = self.primary_key
53
+ self.table_name = self.original_table_name
54
+
50
55
  setup_class_views
51
56
  with_deleted_by
52
57
 
@@ -1,3 +1,3 @@
1
1
  module DeletedAt
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deleted_at
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Stevens