property_sets 3.8.0 → 3.9.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da83a6695b48bf923b2971cc108ad9ab636c9b6f66e50d631f1973601d454bf5
|
4
|
+
data.tar.gz: c4415b9eecc381a94af2bfbcfbe3a9837e4576526648b91a05fb05bc51241207
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89ebdbcb3d8123601c60d4aacee7c4f33b10da3eaafc9406d53457aa941742bcf5348516a9105bf3716196b00e42c9917fa3f2beb4ef5cc88cf4f1aeec58909c
|
7
|
+
data.tar.gz: 5a0c62442a970bb6eb5e43a94b701671306febe920b513bdefcd98c8213884ae29f3a02af9fcaffe5c71fb20517d5bb65a7ae17119929bce9668203c34ace4f9
|
@@ -36,7 +36,7 @@ module PropertySets
|
|
36
36
|
:class_name => property_class.name,
|
37
37
|
:autosave => true,
|
38
38
|
:dependent => :destroy,
|
39
|
-
:inverse_of => self.name.underscore.to_sym,
|
39
|
+
:inverse_of => self.name.demodulize.underscore.to_sym,
|
40
40
|
}.merge(options)
|
41
41
|
|
42
42
|
# TODO: should check options are compatible? warn? raise?
|
@@ -126,12 +126,12 @@ module PropertySets
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
def save(
|
130
|
-
each { |p| p.save(
|
129
|
+
def save(...)
|
130
|
+
each { |p| p.save(...) }
|
131
131
|
end
|
132
132
|
|
133
|
-
def save!(
|
134
|
-
each { |p| p.save!(
|
133
|
+
def save!(...)
|
134
|
+
each { |p| p.save!(...) }
|
135
135
|
end
|
136
136
|
|
137
137
|
def protected?(arg)
|
@@ -137,9 +137,10 @@ module PropertySets
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def owner_class=(owner_class_name)
|
140
|
-
@owner_class_sym = owner_class_name.underscore.to_sym
|
141
|
-
|
142
|
-
|
140
|
+
@owner_class_sym = owner_class_name.to_s.demodulize.underscore.to_sym
|
141
|
+
|
142
|
+
belongs_to owner_class_sym, class_name: owner_class_name
|
143
|
+
validates_presence_of owner_class_sym, class_name: owner_class_name
|
143
144
|
validates_uniqueness_of :name, :scope => owner_class_key_sym, :case_sensitive => false
|
144
145
|
attr_accessible owner_class_key_sym, owner_class_sym if defined?(ProtectedAttributes)
|
145
146
|
end
|
data/lib/property_sets.rb
CHANGED
@@ -9,20 +9,21 @@ end
|
|
9
9
|
|
10
10
|
module PropertySets
|
11
11
|
def self.ensure_property_set_class(association, owner_class_name)
|
12
|
-
const_name = "#{owner_class_name}#{association.to_s.singularize.camelcase}"
|
12
|
+
const_name = "#{owner_class_name.demodulize}#{association.to_s.singularize.camelcase}"
|
13
|
+
namespace = owner_class_name.deconstantize.safe_constantize || Object
|
13
14
|
|
14
|
-
unless
|
15
|
+
unless namespace.const_defined?(const_name, false)
|
15
16
|
property_class = Class.new(ActiveRecord::Base) do
|
16
17
|
include PropertySets::PropertySetModel::InstanceMethods
|
17
18
|
extend PropertySets::PropertySetModel::ClassMethods
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
+
namespace.const_set(const_name, property_class)
|
21
22
|
|
22
23
|
property_class.owner_class = owner_class_name
|
23
24
|
property_class.owner_assoc = association
|
24
25
|
end
|
25
26
|
|
26
|
-
|
27
|
+
namespace.const_get(const_name.to_s)
|
27
28
|
end
|
28
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: property_sets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Morten Primdahl
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '7.1'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '5.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '7.1'
|
@@ -132,7 +132,7 @@ homepage: http://github.com/zendesk/property_sets
|
|
132
132
|
licenses:
|
133
133
|
- MIT
|
134
134
|
metadata: {}
|
135
|
-
post_install_message:
|
135
|
+
post_install_message:
|
136
136
|
rdoc_options: []
|
137
137
|
require_paths:
|
138
138
|
- lib
|
@@ -140,15 +140,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
140
|
requirements:
|
141
141
|
- - ">="
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: '2.
|
143
|
+
version: '2.7'
|
144
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
145
|
requirements:
|
146
146
|
- - ">="
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
|
-
rubygems_version: 3.1
|
151
|
-
signing_key:
|
150
|
+
rubygems_version: 3.0.3.1
|
151
|
+
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Property sets for ActiveRecord.
|
154
154
|
test_files: []
|