activerecord_snapshot_view 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/activerecord_snapshot_view/snapshot_view.rb +13 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
@@ -236,6 +236,19 @@ module ActiveRecord
|
|
236
236
|
active_working_table_name || active_table_name
|
237
237
|
end
|
238
238
|
|
239
|
+
# like new_version, but instead of an empty table you start with
|
240
|
+
# a copy of the previous version
|
241
|
+
def updated_version(&block)
|
242
|
+
new_version do
|
243
|
+
sql = <<-EOF
|
244
|
+
insert into #{working_table_name}
|
245
|
+
select * from #{active_table_name}
|
246
|
+
EOF
|
247
|
+
connection.execute(sql)
|
248
|
+
block.call
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
239
252
|
# make the working table temporarily active [ for this thread only ],
|
240
253
|
# execute the block, and if completed without exception then
|
241
254
|
# make the working table permanently active
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 11
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.11.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- mccraig mccraig of the clan mccraig
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-11 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|