inline_forms 1.6.66 → 1.6.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzBlMGNhMGY1ZTEwOTAxMmVmOGRkZTkxNjkzZGI1ZDUwNDNiZmYxNg==
4
+ OTc5Zjk0NjkwMjYzMjVmYzE0MTRjMDhkMjNkMTAyNTc0ZjRlOWY0ZQ==
5
5
  data.tar.gz: !binary |-
6
- ZThmYTlkODNjNTdkMWYwZWFmZWQ3OWJjYzBkMmE2MDFhNGU2MzZjZA==
6
+ NDAxNjM3NzVlNGQ4MGExOTRlZjI0Y2ZlZTlmNzdiMmRkMzgxZmFmOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWJhMjliMTA5MDgxYjVkZWRkOGRmYTVkOGI0MTBlZDEyMDgzOWI0NGM5ZGUw
10
- MTNhZjJiZTA2ZTM4YjU3NDAwYTk3Y2M3NGY5N2I4OTg4NzMxOTllMTQ5Y2Zk
11
- NmM2NTdiYTQyZjViN2NjYWEwYjhlNTBjMzUyOGYxNjQxZDk4Mzc=
9
+ ZGU3M2E2YTY4YWY4MGI3NDE5YmE4NTMzZGU3NTNlNzUxOTNjYWRjMWQ1Mzgz
10
+ Nzc5NGRmYWFmODc5Njg1ZTk5NWU2MWI4OTMwYmNhYWM1NWY3ZDcwMTczNTQz
11
+ NmQxZThmODg2Y2UyZmJlOWJlZjZjMmJlZmNlOTc0NGVhY2M2Y2M=
12
12
  data.tar.gz: !binary |-
13
- NGExZTIxMDhhZDc1MDQ4YTNmZTlkNzhkNWJiMDc2M2I1MmRkODEyN2ViNGMz
14
- MzIyMGNhOGZlZWNhOWRiNDBiNDI2ZjdkYTMxYzQxZmUwYjNmZDE1MzRjMjA3
15
- YmUzOWVkZTA2YzFlNmNmMTdkZGIxNjZjOGU4Nzk3MzViYTE4NDM=
13
+ MTFjMzkzYjIyNjEzMTY0NDcwMTA4ZTFiMjMxNTEwNmQ2YWMzN2JhMzYzYWE0
14
+ YThkYzhlYzEwNWM3YmQwYjQ0MDk3MWFiNzRlNGJjMGJkY2MwNWU2OGJiZTk5
15
+ Njk4NDgwYzViMTUxOGZkMzBmOGM2MmNkOWU5OTlkNzA0MjM2YzE=
@@ -140,8 +140,13 @@ def dropdown_with_other_update(object, attribute)
140
140
  foreign_key = object.class.reflect_on_association(attribute.to_sym).options[:foreign_key] || attribute.foreign_key.to_sym
141
141
  # if there is an attribute attr, then there must be an attribute attr_other
142
142
  other = params[('_' + object.class.to_s.underscore).to_sym][(attribute + "_other").to_sym]
143
- # see if it matches anything
144
- match = attribute.camelcase.constantize.where(name: other).first # problem if there are dupes!
143
+ # see if it matches anything (but we need to look at I18n too!
144
+ lookup_model = attribute.camelcase.constantize
145
+ name_field = 'name_' + I18n.locale.to_s
146
+ name_field = 'name' unless lookup_model.new.respond_to? name_field
147
+ puts 'XXXXXXXXXXXXXXXXXXXX ' + name_field.inspect
148
+ match = lookup_model.where(name_field.to_sym => other).first # problem if there are dupes!
149
+ puts 'XXXXXXXXXXXXXXXXXXXX ' + match.inspect
145
150
  match.nil? ? object[foreign_key] = 0 : object[foreign_key] = match.id # problem if there is a record with id: 0 !
146
151
  match.nil? ? object[attribute + '_other'] = other : object[attribute + '_other'] = nil
147
152
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "1.6.66"
3
+ VERSION = "1.6.67"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.66
4
+ version: 1.6.67
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-29 00:00:00.000000000 Z
11
+ date: 2014-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rvm