gotime-cassandra_object 3.0.4 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/gotime-cassandra_object.gemspec +1 -1
- data/lib/cassandra_object/base.rb +11 -0
- data/test/unit/base_test.rb +12 -0
- metadata +2 -2
@@ -61,6 +61,17 @@ module CassandraObject
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
def initialize_dup(other)
|
65
|
+
@attributes = other.attributes
|
66
|
+
@attributes['created_at'] = nil
|
67
|
+
@attributes['updated_at'] = nil
|
68
|
+
@attributes.delete(self.class.primary_key)
|
69
|
+
@id = nil
|
70
|
+
@new_record = true
|
71
|
+
@destroyed = false
|
72
|
+
super
|
73
|
+
end
|
74
|
+
|
64
75
|
def to_param
|
65
76
|
id
|
66
77
|
end
|
data/test/unit/base_test.rb
CHANGED
@@ -24,6 +24,18 @@ class CassandraObject::BaseTest < CassandraObject::TestCase
|
|
24
24
|
assert !issue.destroyed?
|
25
25
|
end
|
26
26
|
|
27
|
+
test 'dup' do
|
28
|
+
issue = Issue.create description: 'foo'
|
29
|
+
|
30
|
+
dup_issue = issue.dup
|
31
|
+
|
32
|
+
assert dup_issue.new_record?
|
33
|
+
assert_not_equal issue.id, dup_issue.id
|
34
|
+
assert_nil dup_issue.created_at
|
35
|
+
assert_nil dup_issue.updated_at
|
36
|
+
assert_equal 'foo', issue.description
|
37
|
+
end
|
38
|
+
|
27
39
|
test 'equality of new records' do
|
28
40
|
assert_not_equal Issue.new, Issue.new
|
29
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gotime-cassandra_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-07-
|
13
|
+
date: 2012-07-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|