activerecord-cached_at 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 172ead451c54fddc715cc2caa791a8eb64ee2854
4
+ data.tar.gz: aba2523bd6cd9e8934438397c908696b3ed127af
5
+ SHA512:
6
+ metadata.gz: 0af8779024a2f87a249614f37498173e80311c5132e02db7e56c100f3d4fca326c560f451f3c428b7e3f0074e4d94184dbc95adf7eebf00edf1c293108298766
7
+ data.tar.gz: 2e452b8fc450c01ffe41fafbcd2f81554fa983b89a8ebdb3d7a5a9ea2fcb4e1278634bd04e404ea2cc1d8a04dfd5478d3694f20f8eda0ea0709869df26f59172
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # activerecord-cached_at
2
+ Allows ActiveRecord and Rails to use a `cached_at` column for the `cache_key` if available
@@ -0,0 +1,47 @@
1
+ module ActiveRecord
2
+ module Timestamp
3
+ private
4
+ def timestamp_attributes_for_update
5
+ [:updated_at, :updated_on, :cached_at]
6
+ end
7
+
8
+ def timestamp_attributes_for_create
9
+ [:created_at, :created_on, :cached_at]
10
+ end
11
+ end
12
+ end
13
+
14
+
15
+ module ActiveRecord
16
+ module ConnectionAdapters #:nodoc:
17
+
18
+ class TableDefinition
19
+ def timestamps(*args)
20
+ options = args.extract_options!
21
+
22
+ options[:null] = false if options[:null].nil?
23
+
24
+ column(:created_at, :datetime, options)
25
+ column(:updated_at, :datetime, options)
26
+ column(:cached_at, :datetime, options)
27
+ end
28
+ end
29
+
30
+ module SchemaStatements
31
+ def add_timestamps(table_name, options = {})
32
+ options[:null] = false if options[:null].nil?
33
+
34
+ add_column table_name, :created_at, :datetime, options
35
+ add_column table_name, :updated_at, :datetime, options
36
+ add_column table_name, :cached_at, :datetime, options
37
+ end
38
+
39
+ def remove_timestamps(table_name, options = {})
40
+ remove_column table_name, :updated_at
41
+ remove_column table_name, :created_at
42
+ remove_column table_name, :cached_at
43
+ end
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,3 @@
1
+ require 'active_record'
2
+
3
+ require File.expand_path(File.join(__FILE__, '../../../ext/active_record/timestamp'))
@@ -0,0 +1,5 @@
1
+ module ActiveRecord
2
+ module CachedAt
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activerecord-cached_at
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jon Bracy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-reporters
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sqlite3
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Allows ActiveRecord and Rails to use a `cached_at` column for the `cache_key`
112
+ if available
113
+ email:
114
+ - jonbracy@gmail.com
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files:
118
+ - README.md
119
+ files:
120
+ - README.md
121
+ - ext/active_record/timestamp.rb
122
+ - lib/active_record/cached_at.rb
123
+ - lib/active_record/cached_at/version.rb
124
+ homepage: https://github.com/malomalo/activerecord-cached_at
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options:
130
+ - "--main"
131
+ - README.md
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ requirements: []
145
+ rubyforge_project:
146
+ rubygems_version: 2.4.5
147
+ signing_key:
148
+ specification_version: 4
149
+ summary: Allows ActiveRecord and Rails to use a `cached_at` column for the `cache_key`
150
+ if available
151
+ test_files: []