has_many_polymorphic 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'initializer' unless defined? ::Rails::Initializer
|
2
|
-
require 'action_controller/dispatcher' unless defined? ::ActionController::Dispatcher
|
3
|
-
|
4
1
|
module RussellEdge
|
5
2
|
module HasManyPolymorphic
|
6
3
|
|
@@ -12,12 +9,9 @@ This ensures that helper methods are injected into the target classes.
|
|
12
9
|
#define the models that use has_many_polymorphic. has_many_polymorphs combed the file system for models
|
13
10
|
#that had the has_many_polymorphs method. This is not as robust but more efficent. It can be set via
|
14
11
|
#
|
15
|
-
#RussellEdge::HasManyPolymorphic::
|
12
|
+
#RussellEdge::HasManyPolymorphic::OPTIONS = { :models => %w(PreferenceType AnotherModel) }
|
16
13
|
#
|
17
|
-
DEFAULT_OPTIONS = {
|
18
|
-
:models => %w()
|
19
|
-
}
|
20
|
-
|
14
|
+
DEFAULT_OPTIONS = {:models => %w()}
|
21
15
|
mattr_accessor :options
|
22
16
|
@@options = HashWithIndifferentAccess.new(DEFAULT_OPTIONS)
|
23
17
|
|
@@ -35,16 +29,9 @@ This ensures that helper methods are injected into the target classes.
|
|
35
29
|
end
|
36
30
|
end
|
37
31
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
44
|
-
alias_method_chain :after_initialize, :autoload
|
32
|
+
#create Railtie to plugin into rails initialization
|
33
|
+
class RussellEdge::HasManyPolymorphic::RailTie < Rails::Railtie
|
34
|
+
initializer "has_many_polymorphic.autoload_models", :after => :initialize do |app|
|
35
|
+
RussellEdge::HasManyPolymorphic.autoload
|
36
|
+
end
|
45
37
|
end
|
46
|
-
|
47
|
-
ActionController::Dispatcher.to_prepare(:morpheus_autoload) do
|
48
|
-
# Make sure it gets loaded in the app
|
49
|
-
RussellEdge::HasManyPolymorphic.autoload
|
50
|
-
end
|
data/lib/has_many_polymorphic.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'has_many_polymorphic/has_many_polymorphic'
|
2
2
|
ActiveRecord::Base.send :include, RussellEdge::HasManyPolymorphic
|
3
3
|
|
4
|
-
#used to tie into Rails initialization load the models so the relationships are created
|
4
|
+
#used to tie into Rails initialization to load the models so the relationships are created
|
5
5
|
require 'has_many_polymorphic/autoload'
|
6
6
|
|
7
7
|
|
metadata
CHANGED
@@ -1,87 +1,61 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_many_polymorphic
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Russell Holmes
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-05 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: activerecord
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2169155880 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 9
|
30
|
-
segments:
|
31
|
-
- 2
|
32
|
-
- 3
|
33
|
-
- 5
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
34
21
|
version: 2.3.5
|
35
22
|
type: :runtime
|
36
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2169155880
|
37
25
|
description: Simple replacement for has_many_polymorphs
|
38
26
|
email: rholmes@tnsolutionsinc.com
|
39
27
|
executables: []
|
40
|
-
|
41
28
|
extensions: []
|
42
|
-
|
43
29
|
extra_rdoc_files: []
|
44
|
-
|
45
|
-
files:
|
30
|
+
files:
|
46
31
|
- lib/has_many_polymorphic/autoload.rb
|
47
32
|
- lib/has_many_polymorphic/has_many_polymorphic.rb
|
48
33
|
- lib/has_many_polymorphic/version.rb
|
49
34
|
- lib/has_many_polymorphic.rb
|
50
35
|
- MIT-LICENSE.txt
|
51
36
|
- README.rdoc
|
52
|
-
has_rdoc: true
|
53
37
|
homepage: https://github.com/russ1985/has_many_polymorphic
|
54
38
|
licenses: []
|
55
|
-
|
56
39
|
post_install_message:
|
57
40
|
rdoc_options: []
|
58
|
-
|
59
|
-
require_paths:
|
41
|
+
require_paths:
|
60
42
|
- lib
|
61
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
44
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
|
67
|
-
|
68
|
-
- 0
|
69
|
-
version: "0"
|
70
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
50
|
none: false
|
72
|
-
requirements:
|
73
|
-
- -
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
|
76
|
-
segments:
|
77
|
-
- 0
|
78
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
79
55
|
requirements: []
|
80
|
-
|
81
56
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.
|
57
|
+
rubygems_version: 1.8.6
|
83
58
|
signing_key:
|
84
59
|
specification_version: 3
|
85
60
|
summary: Simple replacement for has_many_polymorphs
|
86
61
|
test_files: []
|
87
|
-
|