custom_fields 2.4.0.rc6 → 2.4.0.rc7

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: 7300ac3903e5328e36011a9531566872072943ec
4
- data.tar.gz: 4f69f49030c1875a48e3d7517258fd074210ec76
3
+ metadata.gz: 87df1a5363f364270445953e385d170011067511
4
+ data.tar.gz: a19f613def98a8e1645d0eeedebda766e2a4871c
5
5
  SHA512:
6
- metadata.gz: 494214dab5c2cd0d3b57109ec8c7b54fd60d31be8a3f7b41825fd5424030a35020e946f2436da88c69354721bac2226009f34b38db9b1329efb3ef14a51e138f
7
- data.tar.gz: 5d3f2c4651ad04fca0f125c4c6674351a1209cef765a0007a337c885dd9e0b2091df8570c584175d3f4b91898bb0fed3bb31e69581a55b69c363e9fcb684ab4a
6
+ metadata.gz: 73b12b42934e2a35e19e8a4562f4ecfd48b82b39c3e9e775128b9bc4d6a3b421f491725d3c833ee873d30bf967d4dc6234bd9865a988cf10ce2597710c5cc203
7
+ data.tar.gz: 5bf856dc422e77f8fbffc11133584b85fa5625ed3faa00db61a4169da6877bcafb4bff4b498affb8c0a90429d12c4e59186bef93f3c42f4e76329c6ec26bc19b
@@ -11,7 +11,7 @@ module CustomFields
11
11
  included do
12
12
 
13
13
  def belongs_to_to_recipe
14
- { 'class_name' => self.class_name }
14
+ { 'class_name' => self.class_name, 'inverse_of' => self.inverse_of }
15
15
  end
16
16
 
17
17
  def belongs_to_is_relationship?
@@ -42,7 +42,10 @@ module CustomFields
42
42
 
43
43
  klass.field position_name, type: ::Integer, default: 0
44
44
 
45
- klass.belongs_to rule['name'].to_sym, class_name: rule['class_name']
45
+ options = { class_name: rule['class_name'] }
46
+ options[:inverse_of] = rule['inverse_of'] unless rule['inverse_of'].blank? # an empty String can cause weird behaviours
47
+
48
+ klass.belongs_to rule['name'].to_sym, options
46
49
 
47
50
  if rule['required']
48
51
  klass.validates_presence_of rule['name'].to_sym
@@ -1,5 +1,5 @@
1
1
  module CustomFields #:nodoc
2
2
 
3
- VERSION = '2.4.0.rc6'
3
+ VERSION = '2.4.0.rc7'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0.rc6
4
+ version: 2.4.0.rc7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-23 00:00:00.000000000 Z
11
+ date: 2015-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid