mcfly 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -31,10 +31,10 @@ Or add it to your `Gemfile`, etc.
|
|
31
31
|
## Usage
|
32
32
|
|
33
33
|
To create Mcfly enabled tables, they need to be created using
|
34
|
-
`
|
34
|
+
`Mcfly::McflyMigration` or `Mcfly::McflyAppendOnlyMigration` instead
|
35
35
|
of the usual `ActiveRecord::Migration`.
|
36
36
|
|
37
|
-
class CreateSecurityInstruments <
|
37
|
+
class CreateSecurityInstruments < McflyAppendOnlyMigration
|
38
38
|
def change
|
39
39
|
create_table :security_instruments do |t|
|
40
40
|
t.string :name, null: false
|
@@ -43,7 +43,7 @@ of the usual `ActiveRecord::Migration`.
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
class CreateMarketPrices <
|
46
|
+
class CreateMarketPrices < McflyMigration
|
47
47
|
def change
|
48
48
|
create_table :market_prices do |t|
|
49
49
|
t.references :security_instrument, null: false
|
data/lib/mcfly.rb
CHANGED
data/lib/mcfly/has_mcfly.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'delorean_lang'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Mcfly
|
4
4
|
module Model
|
5
5
|
|
6
6
|
class AssociationValidator < ActiveModel::Validator
|
@@ -28,7 +28,7 @@ module McFly
|
|
28
28
|
# FIXME: this methods gets a append_only option sometimes. It
|
29
29
|
# needs to add model level validations which prevent update
|
30
30
|
# when this option is present. Note that we need to allow
|
31
|
-
# delete. Deletion of
|
31
|
+
# delete. Deletion of Mcfly objects obsoletes them by setting
|
32
32
|
# obsoleted_dt.
|
33
33
|
|
34
34
|
send :include, InstanceMethods
|
@@ -74,7 +74,7 @@ module McFly
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def mcfly_belongs_to(name, options = {})
|
77
|
-
validates_with
|
77
|
+
validates_with Mcfly::Model::AssociationValidator, field: name
|
78
78
|
belongs_to(name, options)
|
79
79
|
end
|
80
80
|
|
data/lib/mcfly/migration.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class McflyMigration < ActiveRecord::Migration
|
2
2
|
INSERT_TRIG, UPDATE_TRIG, UPDATE_APPEND_ONLY_TRIG, DELETE_TRIG =
|
3
3
|
%w{insert_trig update_trig update_append_only_trig delete_trig}.map { |f|
|
4
4
|
File.read(File.dirname(__FILE__) + "/#{f}.sql")
|
@@ -22,7 +22,7 @@ class McFlyMigration < ActiveRecord::Migration
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
class
|
25
|
+
class McflyAppendOnlyMigration < McflyMigration
|
26
26
|
# append-only update trigger disallows updates
|
27
27
|
TRIGS = [INSERT_TRIG, UPDATE_APPEND_ONLY_TRIG, DELETE_TRIG]
|
28
28
|
end
|
data/lib/mcfly/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.6
|
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-
|
12
|
+
date: 2013-08-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|