fides 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a7f704749dcd05ef1186b0a46f0cad900ab00ed
4
- data.tar.gz: 9f933f47a0b8fd70fe54fb1cb816a376cd42730d
3
+ metadata.gz: a2f7ad27b8fcf4775b3d93dbf0b81e92189d35cb
4
+ data.tar.gz: 80f98cbff22f202f192d171085026d1ffe334c71
5
5
  SHA512:
6
- metadata.gz: dbe549233fb1bd8f5bdcd42dea5c2ab84e4a5e958b7322db74a35ae5c2ac439dd4c691ed4fa5c879a73efde0b671adf458c847ec8bda676b09411789f7dd4a5f
7
- data.tar.gz: 692e61dafb6e55e1367bcb66ca473c1a80957bcb22f0770fe76539c60561fa74c1fcae0761ed3a44a4d1648d77c2f8cac297a9486a64a569e90c49717ad5697f
6
+ metadata.gz: b68a7524614d75f1632852a822fa042167d08a3b0cb8984e4f231fd2fd313a97b304992d8a827a16b63e70e0fb21159d1679af769aa130345fa3dfe5360dd522
7
+ data.tar.gz: 1e7488197348b392d03897830d57b4097ca9349d61fcd676ad1610282ef576fff53d096cdd06bc727d9499ba1f6b1992f2f6e138d5667afdb9db6c7159cf65a3
data/README.md CHANGED
@@ -37,6 +37,22 @@ you would do the following in a migration:
37
37
 
38
38
  class AddReferentialIntegrityToImageable < ActiveRecord::Migration
39
39
 
40
+ def up
41
+ add_polymorphic_triggers(:polymorphic_model => "Picture", :associated_models => ["Employee", "Product"])
42
+ end
43
+
44
+ def down
45
+ remove_polymorphic_triggers(:polymorphic_model => "Picture")
46
+ end
47
+
48
+ end
49
+
50
+ If you're using Rails < version 3.1, then use Fides in your migration like this:
51
+
52
+ class AddReferentialIntegrityToImageable < ActiveRecord::Migration
53
+
54
+ extend Fides
55
+
40
56
  def self.up
41
57
  add_polymorphic_triggers(:polymorphic_model => "Picture", :associated_models => ["Employee", "Product"])
42
58
  end
data/lib/fides/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fides
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
data/lib/fides.rb CHANGED
@@ -21,6 +21,7 @@ module Fides
21
21
  end
22
22
 
23
23
  def remove_polymorphic_triggers(opts)
24
+ raise ArgumentError, "missing :polymorphic_model from options hash" if !opts.has_key?(:polymorphic_model)
24
25
  polymorphic_model = opts[:polymorphic_model]
25
26
  interface_name = opts.has_key?(:interface_name) ? opts[:interface_name] : interface_name(polymorphic_model)
26
27
 
@@ -5,15 +5,7 @@ describe Fides do
5
5
  before do
6
6
  class Picture < ActiveRecord::Base; end
7
7
  class MyTestMigration < ActiveRecord::Migration; end
8
- class MyTestAssociaiton
9
- def options
10
- { :polymorphic => true }
11
- end
12
-
13
- def name
14
- "imageable"
15
- end
16
- end
8
+ class MyTestAssociaiton; end
17
9
  @my_test_association = MyTestAssociaiton.new
18
10
  @my_test_migration = MyTestMigration.new
19
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fides
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Kraft