scarfacedeb / rails_admin_globalize_field

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

fix config in README.md #19

Closed hube closed 8 years ago

hube commented 9 years ago

Ran into #10, turns out my config was wrong. Fixed this in the README

scarfacedeb commented 8 years ago

@hube I just tested config similar to the one in README and it worked.

Do you have configure/field :locale, :hidden line in Translation model config block?

Can you provide your rails_admin config, and rails_admin version.

hube commented 8 years ago

This was on rails 4.2.3, rails_admin 0.7.0, and rails_admin_globalize_field 0.3.2.

The config that I am using is this:

RailsAdmin.config do |config|
  config.model 'Charity::Translation' do
    visible false

    include_fields :locale, :description, :name

    field :locale, :hidden do
      help ''
    end

    field :name
    field :description
  end
end

Previously, I had configure :locale, :hidden... when I ran into the issue

scarfacedeb commented 8 years ago

@hube Now I see what was the issue.

Calling field methods instead of configure resets rails_admin fields list.
So rails_admin only include those fields that you specify with field call.

In other words, include_fields line was ignored, because you called field instead of configure afterwards.

If you move include_fields below the field calls, everything would work as expected.

But from my own experience, it's safer to use configure + include_fields to prevent such issues.

hube commented 8 years ago

@scarfacedeb At the time that I ran into #10, I was using configure instead of field. Anyway, I'm no longer able to reproduce the issue and now I do need to use field for additional configuration of attributes. Thanks for looking into this