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?
@@ -3,7 +3,7 @@ module Resourceful
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 7
6
- TINY = 22
6
+ TINY = 23
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kelredd-resourceful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.22
4
+ version: 0.7.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding