modalfields 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.7
1
+ 1.1.8
@@ -332,7 +332,14 @@ module ModalFields
332
332
  deleted_model = existing_fields.empty?
333
333
  # up to ActiveRecord 3.1 we had primary_key_name in AssociationReflection; not itis foreign_key
334
334
  association_fields = model.reflect_on_all_associations(:belongs_to).map{ |r|
335
- r.respond_to?(:primary_key_name) ? r.primary_key_name : r.foreign_key
335
+ cols = [r.respond_to?(:primary_key_name) ? r.primary_key_name : r.foreign_key]
336
+ if r.options[:polymorphic]
337
+ t = r.options[:foreign_type]
338
+ t ||= r.foreign_type if r.respond_to?(:foreign_type)
339
+ t ||= cols.first.sub(/_id\Z/,'_type')
340
+ cols << t
341
+ end
342
+ cols
336
343
  }.flatten.map(&:to_s)
337
344
  pk_fields = Array(model.primary_key).map(&:to_s)
338
345
  case show_primary_keys
data/modalfields.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "modalfields"
8
- s.version = "1.1.7"
8
+ s.version = "1.1.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Javier Goizueta"]
12
- s.date = "2012-05-24"
12
+ s.date = "2012-06-12"
13
13
  s.description = "ModelFields is a Rails plugin that adds fields declarations to your models."
14
14
  s.email = "jgoizueta@gmail.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modalfields
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-24 00:00:00.000000000 Z
12
+ date: 2012-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -214,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
214
  version: '0'
215
215
  segments:
216
216
  - 0
217
- hash: -3599470511198925273
217
+ hash: -3427872664158124025
218
218
  required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  none: false
220
220
  requirements: