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
 
@@ -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) ? ":minimum => #{v.first}, :maximum => #{v.last}" : ":maximum => #{v}") },
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}
@@ -59,9 +59,6 @@ module DataMapper
59
59
  end
60
60
 
61
61
  class Class
62
-
63
- include Comparable
64
-
65
62
  def <=>(other)
66
63
  name <=> other.name
67
64
  end
data/rakefile.rb CHANGED
@@ -76,7 +76,7 @@ dm = namespace :dm do
76
76
  end
77
77
  end
78
78
 
79
- PACKAGE_VERSION = '0.3.1'
79
+ PACKAGE_VERSION = '0.3.2'
80
80
 
81
81
  PACKAGE_FILES = FileList[
82
82
  'README',
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.1
7
- date: 2008-04-17 00:00:00 -07:00
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