simple_record 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simple_record.rb +12 -7
- data/test/test_simple_record.rb +1 -1
- metadata +3 -3
data/lib/simple_record.rb
CHANGED
@@ -28,7 +28,7 @@ require 'sdb/active_sdb'
|
|
28
28
|
|
29
29
|
module SimpleRecord
|
30
30
|
|
31
|
-
VERSION = '1.0.
|
31
|
+
VERSION = '1.0.9'
|
32
32
|
|
33
33
|
class Base < RightAws::ActiveSdb::Base
|
34
34
|
|
@@ -306,6 +306,7 @@ module SimpleRecord
|
|
306
306
|
|
307
307
|
@@offset = 9223372036854775808
|
308
308
|
@@padding = 20
|
309
|
+
@@date_format = "%Y-%m-%dT%H:%M:%S"; # Time to second precision
|
309
310
|
|
310
311
|
def self.pad_and_offset(x)
|
311
312
|
# todo: add Float, etc
|
@@ -318,10 +319,15 @@ module SimpleRecord
|
|
318
319
|
return x_str
|
319
320
|
elsif x.respond_to?(:iso8601)
|
320
321
|
# puts x.class.name + ' responds to iso8601'
|
322
|
+
#
|
323
|
+
# There is an issue here where Time.iso8601 on an incomparable value to DateTime.iso8601.
|
324
|
+
# Amazon suggests: 2008-02-10T16:52:01.000-05:00
|
325
|
+
# "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
326
|
+
#
|
321
327
|
if x.is_a? DateTime
|
322
|
-
x_str = x.new_offset(0).
|
328
|
+
x_str = x.new_offset(0).strftime(@@date_format)
|
323
329
|
else
|
324
|
-
x_str = x.getutc.
|
330
|
+
x_str = x.getutc.strftime(@@date_format)
|
325
331
|
end
|
326
332
|
# puts 'utc=' + x_str
|
327
333
|
return x_str
|
@@ -477,7 +483,7 @@ module SimpleRecord
|
|
477
483
|
if objects && objects.size > 0
|
478
484
|
objects.each do |o|
|
479
485
|
ok = o.pre_save
|
480
|
-
raise "Pre save failed on object
|
486
|
+
raise "Pre save failed on object [" + o.inspect + "]" if !ok
|
481
487
|
results << ok
|
482
488
|
next if !ok
|
483
489
|
o.pre_save2
|
@@ -687,10 +693,9 @@ This is done on getters now
|
|
687
693
|
|
688
694
|
# Pad and Offset number attributes
|
689
695
|
options = params[1]
|
690
|
-
|
696
|
+
puts 'options=' + options.inspect
|
691
697
|
convert_condition_params(options)
|
692
|
-
|
693
|
-
# puts 'after collect=' + params.inspect
|
698
|
+
puts 'after collect=' + options.inspect
|
694
699
|
|
695
700
|
results = all ? [] : nil
|
696
701
|
begin
|
data/test/test_simple_record.rb
CHANGED
@@ -11,7 +11,7 @@ class TestSimpleRecord < Test::Unit::TestCase
|
|
11
11
|
@config = YAML::load(File.read('test-config.yml'))
|
12
12
|
puts 'akey=' + @config['amazon']['access_key']
|
13
13
|
puts 'skey=' + @config['amazon']['secret_key']
|
14
|
-
RightAws::ActiveSdb.establish_connection(@config['amazon']['access_key'], @config['amazon']['secret_key'])
|
14
|
+
RightAws::ActiveSdb.establish_connection(@config['amazon']['access_key'], @config['amazon']['secret_key'], :port=>80, :protocol=>"http")
|
15
15
|
SimpleRecord::Base.set_domain_prefix("simplerecord_tests_")
|
16
16
|
end
|
17
17
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 2.0.0
|
24
24
|
version:
|
25
25
|
description: |-
|
26
26
|
An ActiveRecord interface for SimpleDB that takes care of offsets and padding, etc.
|