kelredd-resourceful 0.7.22 → 0.7.23
Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,13 @@ module Resourceful
|
|
15
15
|
force = config.delete(:force) || false
|
16
16
|
foreign_key_name = config.delete(:foreign_key) || "#{self.name.demodulize.underscore}_id"
|
17
17
|
foreign_key_method = config.delete(:foreign_key_method) || 'id'
|
18
|
+
Resourceful.add_to_associations(self.name, clean_name, {
|
19
|
+
:type => :has_many,
|
20
|
+
:class_name => class_name,
|
21
|
+
:foreign_key_name => foreign_key_name,
|
22
|
+
:foreign_key_method => foreign_key_method,
|
23
|
+
:find_method_name => find_method_name
|
24
|
+
})
|
18
25
|
define_method(name) do |*args|
|
19
26
|
reload = args.first || false
|
20
27
|
if reload || (assoc_val = instance_variable_get("@#{clean_name}")).nil?
|
@@ -40,6 +47,13 @@ module Resourceful
|
|
40
47
|
force = config.delete(:force) || false
|
41
48
|
foreign_key_name = config.delete(:foreign_key_name) || 'id'
|
42
49
|
foreign_key_method = config.delete(:foreign_key) || "#{clean_name}_id"
|
50
|
+
Resourceful.add_to_associations(self.name, clean_name, {
|
51
|
+
:type => :belongs_to,
|
52
|
+
:class_name => class_name,
|
53
|
+
:foreign_key_name => foreign_key_name,
|
54
|
+
:foreign_key_method => foreign_key_method,
|
55
|
+
:find_method_name => find_method_name
|
56
|
+
})
|
43
57
|
define_method(name) do |*args|
|
44
58
|
reload = args.first || false
|
45
59
|
if reload || (assoc_val = instance_variable_get("@#{clean_name}")).nil?
|
data/lib/resourceful/version.rb
CHANGED