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 +4 -4
- data/lib/deleted_at/active_record/base.rb +12 -7
- data/lib/deleted_at/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc6d9d446fa6477a7eb22388a7a668a0f4871d79
|
4
|
+
data.tar.gz: de7b054ea2f46a01753866b88d84bc8184e449f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/deleted_at/version.rb
CHANGED