acts_as_removable 0.9.2 → 0.9.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
  SHA1:
3
- metadata.gz: d64a4e7fa07f7ffa3872fc9e3e39c86b1b6b1cc4
4
- data.tar.gz: 37b0cad5a652328df6dc52fdd80879b16cca0253
3
+ metadata.gz: 40644a9e4bae02831511dbbb1517df55c23ec01d
4
+ data.tar.gz: f5009cf18a4fae3a2ba273a09c82bf070a415543
5
5
  SHA512:
6
- metadata.gz: 3d73905579c97e93fe7f7743fb4304b7729116830b8f19af1ba793e87c1f5bc6aaa66cc0fff336ac1f2e3820efc01700b10b11b7fec49b68dedcf6996b226dd7
7
- data.tar.gz: 23123253e8b3e88c184f47066b6d9948ced41868beeb5d4c8b2cfb72b5cdc5b454079818ab6ddb04c3d545ea2966560f2feaaa92d933b413af397cb708d9f19b
6
+ metadata.gz: 2fa89d369aabf5c7ad13b6012c11fa6236c40cba1a041550b49526d99a12c74c85a4c5626fd10624f0d60a125b73dd96e192c1ad4edd01ef0d01f5c9f47e40a7
7
+ data.tar.gz: 3c3d9df0798534c7cd997c1d309602d1f885d754433113e11de79f015cae09727002d65674627653e9cde0e5c829267cfaf5c0e356dafe08ba1e0c3ec468686e
@@ -6,7 +6,7 @@ require 'acts_as_removable/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "acts_as_removable"
8
8
  spec.version = ActsAsRemovable::VERSION
9
- spec.authors = ["Florian Schwab"]
9
+ spec.authors = ["Florian Schwab", "Erik Ernst"]
10
10
  spec.email = ["florian.schwab@sic-software.com"]
11
11
  spec.description = %q{Simplifies handling of pseudo removed records}
12
12
  spec.summary = %q{Simplifies handling of pseudo removed records}
@@ -1,3 +1,3 @@
1
1
  module ActsAsRemovable
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
@@ -28,11 +28,21 @@ module ActsAsRemovable
28
28
  @_acts_as_removable_column_name
29
29
  end
30
30
 
31
- scope :removed, -> {unscoped.where("#{self.table_name}.#{self._acts_as_removable_column_name} IS NOT NULL")}
32
- scope :actives, -> {unscoped.where("#{self.table_name}.#{self._acts_as_removable_column_name} IS NULL")}
33
- default_scope -> {actives} unless options[:without_default_scope]
31
+ scope :removed, -> {
32
+ s = where(all.table[self._acts_as_removable_column_name].not_eq(nil).to_sql).with_default_scope
33
+ s.where_values.delete(all.table[self._acts_as_removable_column_name].eq(nil).to_sql)
34
+ s
35
+ }
34
36
 
35
- define_callbacks :remove, :unremove
37
+ scope :actives, -> {
38
+ s = where(all.table[self._acts_as_removable_column_name].eq(nil).to_sql).with_default_scope
39
+ s.where_values.delete(all.table[self._acts_as_removable_column_name].not_eq(nil).to_sql)
40
+ s
41
+ }
42
+
43
+ default_scope -> {where(all.table[self._acts_as_removable_column_name].eq(nil).to_sql)} unless options[:without_default_scope]
44
+
45
+ define_model_callbacks :remove, :unremove
36
46
 
37
47
  def self.before_remove(*args, &block)
38
48
  set_callback :remove, :before, *args, &block
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_removable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Schwab
8
+ - Erik Ernst
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-07-04 00:00:00.000000000 Z
12
+ date: 2013-08-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activesupport