bsm-models 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bsm/model/coders/abstract_column.rb +1 -1
- data/lib/bsm/model/deletable.rb +8 -2
- data/lib/bsm/model/editable.rb +2 -2
- data/lib/bsm/model/has_many_serialized.rb +1 -1
- data/lib/bsm/model/sti_convertable.rb +1 -6
- data/lib/bsm/model.rb +6 -3
- metadata +15 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68a107120c0c5f44c411f7447348323a7c0ca6ee
|
4
|
+
data.tar.gz: ae4e2a600e05ce1eb233affd003e21ebcea2ceca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d82015d125b38b3185e0ac731884b1082b8d1780210c30f2eef49a621f694c8f0cad045e858225c6f74f2d80a582c35875b9cd568d0a58aabdb2ac19bf848980
|
7
|
+
data.tar.gz: 33e2006f7fe15c1eed43d92fd4897ed571b542ada330461c4390f3676769f42f94900ad3edc80293175857f9b288fc6a98efa7b1dfb357dd9748d337a3026fd3
|
data/lib/bsm/model/deletable.rb
CHANGED
@@ -2,11 +2,17 @@ module Bsm::Model::Deletable
|
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
4
|
included do
|
5
|
-
before_destroy :
|
5
|
+
before_destroy :check_deletable?
|
6
6
|
end
|
7
7
|
|
8
8
|
def deletable?
|
9
|
-
|
9
|
+
raise NotImplementedError
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def check_deletable?
|
15
|
+
throw :abort unless deletable?
|
10
16
|
end
|
11
17
|
|
12
18
|
end
|
data/lib/bsm/model/editable.rb
CHANGED
@@ -14,16 +14,11 @@ module Bsm::Model::StiConvertable
|
|
14
14
|
yield
|
15
15
|
end
|
16
16
|
|
17
|
-
# AR <4.0 compatibility
|
18
|
-
def self.scoping(klass, current_scope, &block)
|
19
|
-
klass.send(:with_scope, current_scope, &block)
|
20
|
-
end if ActiveRecord::VERSION::MAJOR < 4
|
21
|
-
|
22
17
|
module ClassMethods
|
23
18
|
|
24
19
|
# @Override: Allow to specify a kind
|
25
20
|
def new(attributes = nil, *args, &block)
|
26
|
-
kind
|
21
|
+
kind = attributes.delete(:kind) { attributes.delete('kind') } if attributes.respond_to?(:delete)
|
27
22
|
return super if real_type?
|
28
23
|
|
29
24
|
klass = real_descendants.find {|k| k.kind == kind } || fallback_descendant
|
data/lib/bsm/model.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'rails'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
2
5
|
|
3
6
|
module Bsm
|
4
7
|
module Model
|
@@ -14,5 +17,5 @@ module Bsm
|
|
14
17
|
class Railtie < ::Rails::Railtie
|
15
18
|
require 'active_support/i18n'
|
16
19
|
I18n.load_path << File.expand_path('../model/locale/en.yml', __FILE__)
|
17
|
-
end
|
18
|
-
end
|
20
|
+
end if defined?(::Rails::Railtie)
|
21
|
+
end
|
metadata
CHANGED
@@ -1,71 +1,51 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bsm-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: abstract
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: activerecord
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
19
|
+
version: '5.0'
|
34
20
|
- - "<"
|
35
21
|
- !ruby/object:Gem::Version
|
36
|
-
version: 5.
|
22
|
+
version: '5.1'
|
37
23
|
type: :runtime
|
38
24
|
prerelease: false
|
39
25
|
version_requirements: !ruby/object:Gem::Requirement
|
40
26
|
requirements:
|
41
27
|
- - ">="
|
42
28
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
29
|
+
version: '5.0'
|
44
30
|
- - "<"
|
45
31
|
- !ruby/object:Gem::Version
|
46
|
-
version: 5.
|
32
|
+
version: '5.1'
|
47
33
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
34
|
+
name: rspec
|
49
35
|
requirement: !ruby/object:Gem::Requirement
|
50
36
|
requirements:
|
51
37
|
- - ">="
|
52
38
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 5.0.0
|
57
|
-
type: :runtime
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
58
41
|
prerelease: false
|
59
42
|
version_requirements: !ruby/object:Gem::Requirement
|
60
43
|
requirements:
|
61
44
|
- - ">="
|
62
45
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
64
|
-
- - "<"
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 5.0.0
|
46
|
+
version: '0'
|
67
47
|
- !ruby/object:Gem::Dependency
|
68
|
-
name: rspec
|
48
|
+
name: rspec-its
|
69
49
|
requirement: !ruby/object:Gem::Requirement
|
70
50
|
requirements:
|
71
51
|
- - ">="
|
@@ -79,7 +59,7 @@ dependencies:
|
|
79
59
|
- !ruby/object:Gem::Version
|
80
60
|
version: '0'
|
81
61
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
62
|
+
name: sqlite3
|
83
63
|
requirement: !ruby/object:Gem::Requirement
|
84
64
|
requirements:
|
85
65
|
- - ">="
|
@@ -93,7 +73,7 @@ dependencies:
|
|
93
73
|
- !ruby/object:Gem::Version
|
94
74
|
version: '0'
|
95
75
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
76
|
+
name: shoulda-matchers
|
97
77
|
requirement: !ruby/object:Gem::Requirement
|
98
78
|
requirements:
|
99
79
|
- - ">="
|
@@ -107,7 +87,7 @@ dependencies:
|
|
107
87
|
- !ruby/object:Gem::Version
|
108
88
|
version: '0'
|
109
89
|
- !ruby/object:Gem::Dependency
|
110
|
-
name:
|
90
|
+
name: railties
|
111
91
|
requirement: !ruby/object:Gem::Requirement
|
112
92
|
requirements:
|
113
93
|
- - ">="
|
@@ -159,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
139
|
version: 1.8.0
|
160
140
|
requirements: []
|
161
141
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.5.2
|
163
143
|
signing_key:
|
164
144
|
specification_version: 4
|
165
145
|
summary: BSM's very custom model extensions
|