mcfly 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Mcfly is a database table versioning system. It's useful for tracking
4
4
  and auditing changes to database tables. It's also very easy to
5
- access the current state of Mcfly tables at any point in time.
5
+ access the state of Mcfly tables at any point in its history.
6
6
 
7
7
  ![](http://i.imgur.com/IG77ww0.jpg)
8
8
 
@@ -50,16 +50,15 @@ of the usual `ActiveRecord::Migration`.
50
50
  t.decimal :coupon, null: false
51
51
  t.integer :settlement_mm, null: false
52
52
  t.integer :settlement_yy, null: false
53
- # NULL indicates unknown price
54
53
  t.decimal :price
55
54
  end
56
55
  end
57
56
  end
58
57
 
59
- These migration add the necessary versioning triggers for INSERT,
58
+ These migrations add the necessary versioning triggers for INSERT,
60
59
  UPDATE and DELETE operations. The append-only migration disallows
61
- updates. As such, append-only Mcfly tables rows to be INSERTed or
62
- DELETEed, but not modified.
60
+ updates. As such, append-only Mcfly tables allow rows to be INSERTed
61
+ or DELETEed, but not modified.
63
62
 
64
63
  When you declare `has_mcfly` in your model, Mcfly adds some basic
65
64
  functionality to the class.
@@ -81,13 +80,10 @@ functionality to the class.
81
80
  end
82
81
  end
83
82
 
84
- The `has_mcfly` declaration provides the `mcfly_lookup` generator
85
- which is scopes queries to the proper timeline. Also,
86
- `mcfly_validates_uniqueness_of` is Mcfly's scoped version of
87
- ActiveRecord's `validates_uniqueness_of`.
83
+ The `has_mcfly` declaration provides the `mcfly_lookup` generator which scopes queries to the proper timeline. Also, `mcfly_validates_uniqueness_of` is Mcfly's scoped version of ActiveRecord's `validates_uniqueness_of`.
88
84
 
89
- ... TODO ... show examples of adding rows and accessing versions of
90
- data ...
85
+ ## Setting/Finding Responsible Party For A Change
86
+ TODO: discuss using `current_user` method in `ApplicationController`. Also, setting `Mcfly.whodunnit`.
91
87
 
92
88
  ## Implementation
93
89
 
@@ -24,11 +24,10 @@ module McFly
24
24
  end
25
25
 
26
26
  def mcfly_lookup(name, options = {}, &block)
27
- delorean_fn(name, options) do |t, *args|
28
- raise "time cannot be nil" if t.nil?
29
- ts = (t == Float::INFINITY) ? 'infinity' : t
27
+ delorean_fn(name, options) do |ts, *args|
28
+ raise "time cannot be nil" if ts.nil?
30
29
  self.where("obsoleted_dt >= ? AND created_dt < ?", ts, ts).scoping do
31
- block.call(t, *args)
30
+ block.call(ts, *args)
32
31
  end
33
32
  end
34
33
  end
data/lib/mcfly/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mcfly
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcfly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-28 00:00:00.000000000 Z
12
+ date: 2013-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails