inverse_of 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +72 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/install.rb +1 -0
- data/inverse_of.gemspec +76 -0
- data/lib/inverse_of.rb +293 -0
- data/rails/init.rb +1 -0
- data/tasks/inverse_of_tasks.rake +4 -0
- data/test/cases/helper.rb +28 -0
- data/test/cases/inverse_associations_test.rb +567 -0
- data/test/fixtures/clubs.yml +6 -0
- data/test/fixtures/faces.yml +11 -0
- data/test/fixtures/interests.yml +33 -0
- data/test/fixtures/men.yml +5 -0
- data/test/fixtures/sponsors.yml +9 -0
- data/test/fixtures/zines.yml +5 -0
- data/test/models/club.rb +13 -0
- data/test/models/face.rb +7 -0
- data/test/models/interest.rb +5 -0
- data/test/models/man.rb +9 -0
- data/test/models/sponsor.rb +4 -0
- data/test/models/zine.rb +3 -0
- data/test/schema/schema.rb +32 -0
- data/uninstall.rb +1 -0
- metadata +91 -0
data/test/models/man.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
class Man < ActiveRecord::Base
|
2
|
+
has_one :face, :inverse_of => :man
|
3
|
+
has_one :polymorphic_face, :class_name => 'Face', :as => :polymorphic_man, :inverse_of => :polymorphic_man
|
4
|
+
has_many :interests, :inverse_of => :man
|
5
|
+
has_many :polymorphic_interests, :class_name => 'Interest', :as => :polymorphic_man, :inverse_of => :polymorphic_man
|
6
|
+
# These are "broken" inverse_of associations for the purposes of testing
|
7
|
+
has_one :dirty_face, :class_name => 'Face', :inverse_of => :dirty_man
|
8
|
+
has_many :secret_interests, :class_name => 'Interest', :inverse_of => :secret_man
|
9
|
+
end
|
data/test/models/zine.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
create_table :clubs, :force => true do |t|
|
2
|
+
t.string :name
|
3
|
+
end
|
4
|
+
|
5
|
+
create_table :sponsors, :force => true do |t|
|
6
|
+
t.integer :club_id
|
7
|
+
t.integer :sponsorable_id
|
8
|
+
t.string :sponsorable_type
|
9
|
+
end
|
10
|
+
|
11
|
+
create_table :men, :force => true do |t|
|
12
|
+
t.string :name
|
13
|
+
end
|
14
|
+
|
15
|
+
create_table :faces, :force => true do |t|
|
16
|
+
t.string :description
|
17
|
+
t.integer :man_id
|
18
|
+
t.integer :polymorphic_man_id
|
19
|
+
t.string :polymorphic_man_type
|
20
|
+
end
|
21
|
+
|
22
|
+
create_table :interests, :force => true do |t|
|
23
|
+
t.string :topic
|
24
|
+
t.integer :man_id
|
25
|
+
t.integer :polymorphic_man_id
|
26
|
+
t.string :polymorphic_man_type
|
27
|
+
t.integer :zine_id
|
28
|
+
end
|
29
|
+
|
30
|
+
create_table :zines, :force => true do |t|
|
31
|
+
t.string :title
|
32
|
+
end
|
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: inverse_of
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- George Ogata
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-02-05 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Backport of ActiveRecord 2.3.6's inverse associations.
|
17
|
+
email: george.ogata@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.markdown
|
25
|
+
files:
|
26
|
+
- .document
|
27
|
+
- .gitignore
|
28
|
+
- LICENSE
|
29
|
+
- MIT-LICENSE
|
30
|
+
- README.markdown
|
31
|
+
- Rakefile
|
32
|
+
- VERSION
|
33
|
+
- install.rb
|
34
|
+
- inverse_of.gemspec
|
35
|
+
- lib/inverse_of.rb
|
36
|
+
- rails/init.rb
|
37
|
+
- tasks/inverse_of_tasks.rake
|
38
|
+
- test/cases/helper.rb
|
39
|
+
- test/cases/inverse_associations_test.rb
|
40
|
+
- test/fixtures/clubs.yml
|
41
|
+
- test/fixtures/faces.yml
|
42
|
+
- test/fixtures/interests.yml
|
43
|
+
- test/fixtures/men.yml
|
44
|
+
- test/fixtures/sponsors.yml
|
45
|
+
- test/fixtures/zines.yml
|
46
|
+
- test/models/club.rb
|
47
|
+
- test/models/face.rb
|
48
|
+
- test/models/interest.rb
|
49
|
+
- test/models/man.rb
|
50
|
+
- test/models/sponsor.rb
|
51
|
+
- test/models/zine.rb
|
52
|
+
- test/schema/schema.rb
|
53
|
+
- uninstall.rb
|
54
|
+
has_rdoc: true
|
55
|
+
homepage: http://github.com/oggy/inverse_of
|
56
|
+
licenses: []
|
57
|
+
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options:
|
60
|
+
- --charset=UTF-8
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
version:
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: "0"
|
74
|
+
version:
|
75
|
+
requirements: []
|
76
|
+
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 1.3.5
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: Backport of ActiveRecord 2.3.6's inverse associations.
|
82
|
+
test_files:
|
83
|
+
- test/cases/helper.rb
|
84
|
+
- test/cases/inverse_associations_test.rb
|
85
|
+
- test/models/club.rb
|
86
|
+
- test/models/face.rb
|
87
|
+
- test/models/interest.rb
|
88
|
+
- test/models/man.rb
|
89
|
+
- test/models/sponsor.rb
|
90
|
+
- test/models/zine.rb
|
91
|
+
- test/schema/schema.rb
|