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 +4 -4
- data/lib/mass_record/version.rb +1 -1
- data/lib/mass_record.rb +2 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc215f13927be3c930c7498a689789f0f1c5782c
|
4
|
+
data.tar.gz: f64c6a1812c022ee13ee9d0ecfbee983dac58be3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f271941badc11abf47eb1abcfe1ee5976b102ff68652025049c529330b8f44785999cf8212e5eb9224a4150058acde24686ef6f9ae2d2473b47ac0d23649a80c
|
7
|
+
data.tar.gz: 6eb9ecdf2a9fc8ce3817e00a6cacaa3eaaff4d6b8b0bb0672020801ee0dc8acee2b815b2fdb11c55de4519d68eecc529d2d68c862a99172baf9c25bcb13897be
|
data/lib/mass_record/version.rb
CHANGED
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
|
669
|
-
v = time if crud_times.include? k and (v.blank? or k == updated_at) and model.column_names.include? k
|
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.
|
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:
|
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.
|
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,
|