storage_unit 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +3 -0
- data/Appraisals +7 -0
- data/gemfiles/rails_4.gemfile +7 -0
- data/gemfiles/rails_5.gemfile +7 -0
- data/lib/storage_unit/core.rb +5 -13
- data/lib/storage_unit/version.rb +1 -1
- data/storage_unit.gemspec +2 -1
- metadata +19 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 123c75a0205796eeee95d8d58416b98d74e51609
|
4
|
+
data.tar.gz: 31a15c73833dd74c5e9b4ed73ae28616db136950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b1dbf907e0ea28b62168cb73c829657b78f468757c52e2e405fbcccf1aa7b5197cc4d49598f6f80db6524545d0ae0b82d22b4ad2a7f4f1705f2e8499484248a
|
7
|
+
data.tar.gz: 5b2ea9c50b74b8a58741f6273d09d19ca955d12f7f1df46cc0b429a997055453f8dab5601b5904a9d317021352bdd25c3ff655870727f3639e98966c3e3188f4
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.1
|
data/.travis.yml
CHANGED
data/Appraisals
ADDED
data/lib/storage_unit/core.rb
CHANGED
@@ -3,30 +3,22 @@ module StorageUnit
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
default_scope { where(
|
6
|
+
default_scope { where(default_scope_hash) }
|
7
7
|
define_model_callbacks :trash
|
8
8
|
define_model_callbacks :recover
|
9
9
|
end
|
10
10
|
|
11
11
|
module ClassMethods
|
12
|
-
def
|
13
|
-
|
12
|
+
def default_scope_hash
|
13
|
+
{ storage_unit_opts[:column] => nil }
|
14
14
|
end
|
15
15
|
|
16
|
-
def deleted_only_scope_sql
|
17
|
-
all.table[storage_unit_opts[:column]].not_eq(nil).to_sql
|
18
|
-
end
|
19
|
-
|
20
|
-
# lifted from acts_as_paranoid, works around https://github.com/rails/rails/issues/4306
|
21
|
-
# with this in place Post.limit(10).with_deleted, will work as expected
|
22
16
|
def with_deleted
|
23
|
-
|
24
|
-
scope.where_values.delete(with_deleted_scope_sql)
|
25
|
-
scope
|
17
|
+
self.all.unscope(where: storage_unit_opts[:column])
|
26
18
|
end
|
27
19
|
|
28
20
|
def deleted_only
|
29
|
-
with_deleted.where(
|
21
|
+
with_deleted.where.not(default_scope_hash)
|
30
22
|
end
|
31
23
|
end
|
32
24
|
|
data/lib/storage_unit/version.rb
CHANGED
data/storage_unit.gemspec
CHANGED
@@ -19,8 +19,9 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.homepage = 'http://github.com/dobtco/storage_unit'
|
21
21
|
|
22
|
-
s.add_dependency 'rails', '
|
22
|
+
s.add_dependency 'rails', '>= 4.1.0'
|
23
23
|
|
24
|
+
s.add_development_dependency 'appraisal'
|
24
25
|
s.add_development_dependency 'coveralls'
|
25
26
|
s.add_development_dependency 'guard-rspec'
|
26
27
|
s.add_development_dependency 'rspec-rails'
|
metadata
CHANGED
@@ -1,22 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: storage_unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Becker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '4.1'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 4.1.0
|
@@ -24,12 +21,23 @@ dependencies:
|
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '4.1'
|
30
24
|
- - ">="
|
31
25
|
- !ruby/object:Gem::Version
|
32
26
|
version: 4.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: appraisal
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
33
41
|
- !ruby/object:Gem::Dependency
|
34
42
|
name: coveralls
|
35
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,10 +104,13 @@ files:
|
|
96
104
|
- ".gitignore"
|
97
105
|
- ".ruby-version"
|
98
106
|
- ".travis.yml"
|
107
|
+
- Appraisals
|
99
108
|
- Gemfile
|
100
109
|
- Guardfile
|
101
110
|
- LICENSE.md
|
102
111
|
- README.md
|
112
|
+
- gemfiles/rails_4.gemfile
|
113
|
+
- gemfiles/rails_5.gemfile
|
103
114
|
- lib/storage_unit.rb
|
104
115
|
- lib/storage_unit/core.rb
|
105
116
|
- lib/storage_unit/setup.rb
|