property_sets 3.3.0 → 3.5.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
- SHA1:
3
- metadata.gz: 3ac3f25a9d664d3c11c22b27fcc295998bfa1ded
4
- data.tar.gz: 6a46c42e0ec6ab7b07b750ea09660291c21a8735
2
+ SHA256:
3
+ metadata.gz: e5b1904f990b0edf7d1a91f1ac6b703f9bddc428d280e031ae4daaa6983f6835
4
+ data.tar.gz: cea92b99f11a508d543d9ff4f812e9326ae30aefa06e448619b19ab6dc1dbe02
5
5
  SHA512:
6
- metadata.gz: a1eed5ef6c30432eedc454135c98463a3577f239c9f1b08de2af588133529eddf19c70e17625ca7091f8e1a5715069a52b4ef53eb4713bb6404a4aa2ee01bf72
7
- data.tar.gz: 7e7d583269e88e7dd746f526bad20dfcbeec7c0af76cc9aa49d5e31692ceec41c4943a563e3bd08d2aad2c95b1a73088d691e63831d46b30e1b263d56675b4b6
6
+ metadata.gz: bc1e1b4afd64f05275f2123fb05e9614009eb3ecfb4e8d4940fc74811300a15c2cd7dc13db75ec9d5883d66f81aa2ec4ae637e7039f10ffedbadcb198190c499
7
+ data.tar.gz: 976d4c41225d97445c1c9ebf78b19d55d97465c1dce1731fb648d81b1d4e9a35b3446cbfb2e3a5491a6e63c3a1b7172c92533303cc239853c409cb558f951323
@@ -158,26 +158,22 @@ module PropertySets
158
158
  end
159
159
 
160
160
  def association_class
161
- @association_class ||= begin
162
- if ActiveRecord::VERSION::STRING >= "3.1.0"
163
- proxy_association.klass
164
- else
165
- @reflection.klass
166
- end
167
- end
161
+ @association_class ||= proxy_association.klass
168
162
  end
169
163
  end
170
164
 
171
165
  module InstanceMethods
172
- def update_attributes(attributes)
166
+ def update(attributes)
173
167
  update_property_set_attributes(attributes)
174
168
  super
175
169
  end
170
+ alias update_attributes update
176
171
 
177
- def update_attributes!(attributes)
172
+ def update!(attributes)
178
173
  update_property_set_attributes(attributes)
179
174
  super
180
175
  end
176
+ alias update_attributes! update!
181
177
 
182
178
  def update_property_set_attributes(attributes)
183
179
  if attributes && self.class.property_set_index.any?
@@ -21,10 +21,18 @@ module PropertySets
21
21
  raise "Second argument must be a Hash" unless mappings.is_a?(Hash)
22
22
 
23
23
  mappings.each do |old_attr, new_attr|
24
+ if ActiveRecord.version < Gem::Version.new("5.0")
25
+ attribute old_attr, ActiveRecord::Type::Value.new
26
+ else
27
+ attribute old_attr, ActiveModel::Type::Value.new
28
+ end
24
29
  define_method(old_attr) { send(setname).send(new_attr) }
25
30
  alias_method "#{old_attr}_before_type_cast", old_attr
26
31
  define_method("#{old_attr}?") { send(setname).send("#{new_attr}?") }
27
- define_method("#{old_attr}=") { |value| send(setname).send("#{new_attr}=", value) }
32
+ define_method("#{old_attr}=") do |value|
33
+ send(setname).send("#{new_attr}=", value)
34
+ super(value)
35
+ end
28
36
 
29
37
  define_method("#{old_attr}_changed?") do
30
38
  collection_proxy = send(setname)
@@ -105,7 +105,7 @@ module PropertySets
105
105
  base.validate :validate_format_of_name
106
106
  base.validate :validate_length_of_serialized_data
107
107
  base.before_create :coerce_value
108
- base.attr_accessible :name, :value if ActiveRecord::VERSION::MAJOR == 3 || defined?(ProtectedAttributes)
108
+ base.attr_accessible :name, :value if defined?(ProtectedAttributes)
109
109
  end
110
110
 
111
111
  def property(key, options = nil)
@@ -137,8 +137,8 @@ module PropertySets
137
137
  @owner_class_sym = owner_class_name.underscore.to_sym
138
138
  belongs_to owner_class_sym
139
139
  validates_presence_of owner_class_sym
140
- validates_uniqueness_of :name, :scope => owner_class_key_sym
141
- attr_accessible owner_class_key_sym, owner_class_sym if ActiveRecord::VERSION::MAJOR == 3 || defined?(ProtectedAttributes)
140
+ validates_uniqueness_of :name, :scope => owner_class_key_sym, :case_sensitive => false
141
+ attr_accessible owner_class_key_sym, owner_class_sym if defined?(ProtectedAttributes)
142
142
  end
143
143
 
144
144
  def owner_assoc=(association)
@@ -1,3 +1,3 @@
1
1
  module PropertySets
2
- VERSION = "3.3.0"
2
+ VERSION = "3.5.3"
3
3
  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.3.0
4
+ version: 3.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morten Primdahl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-13 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.2'
22
+ version: '6.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '3.2'
29
+ version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.2'
32
+ version: '6.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: json
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -154,15 +154,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
154
  requirements:
155
155
  - - ">="
156
156
  - !ruby/object:Gem::Version
157
- version: '0'
157
+ version: '2.4'
158
158
  required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  requirements:
160
160
  - - ">="
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  requirements: []
164
- rubyforge_project:
165
- rubygems_version: 2.4.5.1
164
+ rubygems_version: 3.0.3
166
165
  signing_key:
167
166
  specification_version: 4
168
167
  summary: Property sets for ActiveRecord.