mass_record 0.0.4.3 → 0.0.4.4

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
  SHA1:
3
- metadata.gz: 3f81b4143ff8bd86095283d3fc72e1b9acef7984
4
- data.tar.gz: b732332c3c523cf626c1054d7b0133acedca163c
3
+ metadata.gz: dc215f13927be3c930c7498a689789f0f1c5782c
4
+ data.tar.gz: f64c6a1812c022ee13ee9d0ecfbee983dac58be3
5
5
  SHA512:
6
- metadata.gz: 1deff000000e7b1dafbf63b1cc24eb7d67a8d0af4be7bbfd9c4bcf78c055b4f714cc9c06d27627dd507ac4b31b1b0b36aaed124ffba8e7fa74a0ec08ebda6d67
7
- data.tar.gz: c20591f835caea156f32d9478466051a41b818324b94c3b832469f9ae153f1089223ca4b7aecceebc8d88ed88660c79ceae6394408787370161a25865ddea922
6
+ metadata.gz: f271941badc11abf47eb1abcfe1ee5976b102ff68652025049c529330b8f44785999cf8212e5eb9224a4150058acde24686ef6f9ae2d2473b47ac0d23649a80c
7
+ data.tar.gz: 6eb9ecdf2a9fc8ce3817e00a6cacaa3eaaff4d6b8b0bb0672020801ee0dc8acee2b815b2fdb11c55de4519d68eecc529d2d68c862a99172baf9c25bcb13897be
@@ -1,3 +1,3 @@
1
1
  module MassRecord
2
- VERSION = "0.0.4.3" # removed application helper to avoid a file load error
2
+ VERSION = "0.0.4.4" # updated the date data conversion handling
3
3
  end
data/lib/mass_record.rb CHANGED
@@ -661,12 +661,11 @@ module MassRecord
661
661
  def convert_to_db_format json_object, model:nil, created_at:'created_at', updated_at:'updated_at'
662
662
  throw "No Model provided, cannot format the data for the specified columns" if model.blank?
663
663
 
664
- json_date_regex = /^"?\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}[\+\-]\d{2}:\d{2}"?$/i
665
664
  time = Time.now.to_s(:db)
666
665
  crud_times = [created_at,updated_at]
667
666
  json_object.each do |k,v|
668
- v = Time.parse v if v.is_a? String and v =~ json_date_regex # fix funky to_json format if present
669
- v = time if crud_times.include? k and (v.blank? or k == updated_at) and model.column_names.include? k # add crud time if it is blank and it is a column in the model or if it is update_at just add the time
667
+ v = Time.parse v if v.is_a? String and [:datetime, :date, :time, :timestamp].include? model.column_types[k].type.to_sym.downcase # fix funky to_json format if present
668
+ v = time if crud_times.include? k and (v.blank? or k == updated_at) and model.column_names.include? k # add crud time if it is blank and it is a column in the model or if it is update_at just add the time
670
669
 
671
670
  # convert to correct database type
672
671
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mass_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.3
4
+ version: 0.0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hanna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-15 00:00:00.000000000 Z
11
+ date: 2015-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
242
  version: '0'
243
243
  requirements: []
244
244
  rubyforge_project:
245
- rubygems_version: 2.4.4
245
+ rubygems_version: 2.4.5
246
246
  signing_key:
247
247
  specification_version: 4
248
248
  summary: A Ruby on Rails library to help with mass database operations like insert,