datamapper 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -357,7 +357,7 @@ module DataMapper
|
|
357
357
|
setter_method = "#{@association_name}=".to_sym
|
358
358
|
|
359
359
|
@instance.loaded_set.each do |entry|
|
360
|
-
entry.send(setter_method, associated_items[entry.key])
|
360
|
+
entry.send(setter_method, associated_items[entry.key]) if entry.respond_to?(setter_method)
|
361
361
|
end # @instance.loaded_set.each
|
362
362
|
|
363
363
|
@entries
|
@@ -190,7 +190,7 @@ module DataMapper
|
|
190
190
|
association_ivar_name = association.instance_variable_name
|
191
191
|
setter_method = "#{@association_name}=".to_sym
|
192
192
|
@instance.loaded_set.each do |entry|
|
193
|
-
entry.send(setter_method, associated_items[entry.key])
|
193
|
+
entry.send(setter_method, associated_items[entry.key]) if entry.respond_to?(setter_method)
|
194
194
|
end # @instance.loaded_set.each
|
195
195
|
end # if @instance.loaded_set.nil?
|
196
196
|
|
data/lib/data_mapper/property.rb
CHANGED
@@ -247,7 +247,7 @@ module DataMapper
|
|
247
247
|
# NOTE: :length may also be used in place of :size
|
248
248
|
AUTO_VALIDATIONS = {
|
249
249
|
:nullable => lambda { |k,v| "validates_presence_of :#{k}" if v == false },
|
250
|
-
:size => lambda { |k,v| "validates_length_of :#{k}, " + (v.is_a?(Range) ? ":
|
250
|
+
:size => lambda { |k,v| "validates_length_of :#{k}, " + (v.is_a?(Range) ? ":within => #{v}" : ":maximum => #{v}") },
|
251
251
|
:format => lambda { |k, v| "validates_format_of :#{k}, :with => #{v.inspect}" }
|
252
252
|
}
|
253
253
|
|
@@ -258,7 +258,7 @@ module DataMapper
|
|
258
258
|
AUTO_VALIDATIONS.each do |key, value|
|
259
259
|
next unless options.has_key?(key)
|
260
260
|
validation = value.call(name, options[key])
|
261
|
-
next if validation.empty?
|
261
|
+
next if validation.nil? or validation.empty?
|
262
262
|
klass.class_eval <<-EOS
|
263
263
|
begin
|
264
264
|
#{validation}
|
data/rakefile.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: datamapper
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.3.
|
7
|
-
date: 2008-04-
|
6
|
+
version: 0.3.2
|
7
|
+
date: 2008-04-30 00:00:00 -07:00
|
8
8
|
summary: An Object/Relational Mapper for Ruby
|
9
9
|
require_paths:
|
10
10
|
- lib
|