scarfacedeb / rails_admin_globalize_field

Tabbed interface and custom field type for globalize translations for Rails_admin
MIT License
50 stars 60 forks source link

Call compact on translations.keys to fix calling to_sym on nil #12

Closed travisvalentine closed 9 years ago

travisvalentine commented 9 years ago

This should fix #10. I reproduced it by attempting to save my Page model translations. Here's what my model looks like:

class Page < ActiveRecord::Base
  has_many :statistics

  translates :hero_title, :hero_subtitle
  accepts_nested_attributes_for :translations, allow_destroy: true
end

It looks like this error occurs when there are no other translations for other locales besides the default. Once the translation for the new locale is added, the error isn't thrown.

scarfacedeb commented 9 years ago

I think that the issue in #10 was caused by omitted locale field, which should be always required and shown in a form. (in a hidden field)

So, I'm not sure that it's the matter of this gem to resolve it.

But if it's not the source of that issue, could you provide your rails_admin config, please?

travisvalentine commented 9 years ago

@scarfacedeb Yeah, I think you're right. Thanks!