gotime-cassandra_object 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,14 +3,31 @@ require 'i18n'
3
3
  require 'active_support'
4
4
  require 'active_model'
5
5
 
6
-
7
6
  module CassandraObject
8
7
  extend ActiveSupport::Autoload
9
8
 
10
9
  autoload :Base
11
-
12
- require 'cassandra_object/migrator'
13
- require 'cassandra_object/migration'
10
+ autoload :Attributes
11
+ autoload :Dirty
12
+ autoload :Consistency
13
+ autoload :Persistence
14
+ autoload :Callbacks
15
+ autoload :Validation
16
+ autoload :Identity
17
+ autoload :Indexes
18
+ autoload :Serialization
19
+ autoload :Associations
20
+ autoload :Migrations
21
+ autoload :Cursor
22
+ autoload :Collection
23
+ autoload :Types
24
+ autoload :Mocking
25
+ autoload :FindEach
26
+ autoload :FindWithIds
27
+ autoload :Timestamps
28
+
29
+ autoload :Migrator
30
+ autoload :Migration
14
31
 
15
32
  module Tasks
16
33
  extend ActiveSupport::Autoload
@@ -23,5 +40,4 @@ module CassandraObject
23
40
  module Generators
24
41
  require 'cassandra_object/generators/migration_generator'
25
42
  end
26
-
27
43
  end
@@ -1,24 +1,5 @@
1
1
  require 'cassandra/0.7'
2
2
  require 'set'
3
- require 'cassandra_object/attributes'
4
- require 'cassandra_object/dirty'
5
- require 'cassandra_object/consistency'
6
- require 'cassandra_object/persistence'
7
-
8
- require 'cassandra_object/callbacks'
9
-
10
- require 'cassandra_object/validation'
11
- require 'cassandra_object/identity'
12
- require 'cassandra_object/indexes'
13
- require 'cassandra_object/serialization'
14
- require 'cassandra_object/associations'
15
- require 'cassandra_object/migrations'
16
- require 'cassandra_object/cursor'
17
- require 'cassandra_object/collection'
18
- require 'cassandra_object/types'
19
- require 'cassandra_object/mocking'
20
- require 'cassandra_object/find_each'
21
- require 'cassandra_object/find_with_ids'
22
3
 
23
4
  require 'cassandra_object/log_subscriber'
24
5
 
@@ -0,0 +1,23 @@
1
+ module CassandraObject
2
+ module Timestamps
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ class_attribute :timestamp_override
7
+
8
+ attribute :created_at, :type => :time_with_zone
9
+ attribute :updated_at, :type => :time_with_zone
10
+
11
+ before_create :set_created_at
12
+ before_save :set_updated_at
13
+ end
14
+
15
+ def set_created_at
16
+ self.created_at = Time.current unless self.class.timestamp_override
17
+ end
18
+
19
+ def set_updated_at
20
+ self.updated_at = Time.current unless self.class.timestamp_override
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,5 @@
1
+ require 'cassandra_object/types'
2
+
1
3
  CassandraObject::Base.register_attribute_type(:integer, Integer, CassandraObject::IntegerType)
2
4
  CassandraObject::Base.register_attribute_type(:float, Float, CassandraObject::FloatType)
3
5
  CassandraObject::Base.register_attribute_type(:date, Date, CassandraObject::DateType)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gotime-cassandra_object
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.0
5
+ version: 0.8.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael Koziarski
@@ -143,6 +143,7 @@ files:
143
143
  - lib/cassandra_object/tasks/column_family.rb
144
144
  - lib/cassandra_object/tasks/keyspace.rb
145
145
  - lib/cassandra_object/tasks/ks.rb
146
+ - lib/cassandra_object/timestamps.rb
146
147
  - lib/cassandra_object/type_registration.rb
147
148
  - lib/cassandra_object/types.rb
148
149
  - lib/cassandra_object/validation.rb