Here I have a problem when using rails 4.2.4 + activeadmin 0.6.6 + rails-i18n 4.0.8 + globalize 4.0.3 + activeadmin-globalize 1.0.0 . The problem I am facing is shown in the following image, it only show one input box for me:
In the contact table, I should have more variables as below:
db/migrate/XXXXXXXXX_create_contacts.rb
class CreateContacts < ActiveRecord::Migration
def up
create_table :contacts do |t|
t.string :url
t.boolean :publish, :default => false
t.integer :sequence
t.timestamps null: false
end
end
def down
drop_table :contacts
end
end
db/migrate/XXXXXXXXX_translate_for_contacts.rb
class TranslateForContact < ActiveRecord::Migration
def up
Contact.create_translation_table! :tool => :string, :content => :text
end
def down
Contact.drop_translation_table!
end
end
Contact table is originally generated using scaffold.
:url, :publish, :sequence are the variables common in all locales.
Only :tool and :content need to translate.
In app/models/contact.rb
class Contact < ActiveRecord::Base
active_admin_translates :tool, :content do
validates_presence_of :tool, :content
end
translates :tool, :content
end
In app/admin/contact.rb
ActiveAdmin.register Contact do
permit_params :url, :tool, :content, :publish, :sequence, translations_attributes: [:id, :locale, :tool, :content]
index do
translation_status
default_actions
end
form do |f|
f.translated_inputs "Translated fields", switch_locale: false do |t|
t.input :tool
t.input :content
end
f.actions
end
end
One more related thing, as I have also facing the "missing form_buffers" problem, I have edited the code in the activeadmin-globalize gem as following webpage:
https://github.com/maxime-carbonneau/activeadmin-globalize/commit/734f375152982ccde12e7810760a7ab82c8d4a20
but I am not sure if this edit will cause the problem.
Before I install and use activeadmin-globalize, I am sure there are the input boxes for :url, :publish, :sequence.
Do anyone have the solution or know what's happened? Thanks!
----------------Final Solution--------------------
As activeadmin-globalize is not maintained, most of it function not work normally. I recommend using another gem for it.