lib/kirbybase.rb in KirbyBase-2.5.1 vs lib/kirbybase.rb in KirbyBase-2.5.2

- old
+ new

@@ -144,11 +144,17 @@ # * Changed the KBTable#clear method to return number of records deleted. # Thanks to Assaph Mehr for this enhancement. # * Moved #build_header_string from KBEngine class to KirbyBase class. # * Added KirbyBase::VERSION constant. # +# 2005-12-30:: Version 2.5.2 +# * Changed the behavior of KBTable#insert method. If user explicitly +# specifies nil for a field value and there is a default value for that +# field, the default value will no longer override the user specified nil +# value. Thanks to Assaph Mehr for suggesting this. # +# #--------------------------------------------------------------------------- # KBTypeConversionsMixin #--------------------------------------------------------------------------- module KBTypeConversionsMixin # Regular expression used to determine if field needs to be un-encoded. @@ -334,11 +340,11 @@ #--------------------------------------------------------------------------- class KirbyBase include DRb::DRbUndumped include KBTypeConversionsMixin - VERSION = "2.5.1" + VERSION = "2.5.2" attr_reader :engine attr_accessor(:connect_type, :host, :port, :path, :ext, :memo_blob_path, :delay_index_creation) @@ -2100,13 +2106,13 @@ # Check the field values to make sure they are proper types. validate_input(input_rec) input_rec = Struct.new(*field_names).new(*field_names.zip( @field_defaults).collect do |fn, fd| - if input_rec[fn].nil? - fd - else + if input_rec.has_key?(fn) input_rec[fn] + else + fd end end) check_required_fields(input_rec)