块:
form do |f| | f |
f.translate_inputs of | t |
t.input : title
t.input : text
t.input : locale , as: : hidden
end
f.actions
end
总是显示最后一个字段,我相信问题出在 gem 'activeadmin -translate'github'rbatllet/activeadmin -translate'。
管理员/POST.RB
ActiveAdmin.register Post do # if you are using Rails 4 or Strong
Parameters: permit_params :title, :text, translations_attributes:
[:locale, :title, :text, :id]
index do
# ...
translation_status
# ...
#default_actions end
form do |f|
f.translate_inputs do |t|
t.input :title
t.input :text
t.input :locale, as: :hidden
end
f.actions end end
模型/post.rb
class Post < ActiveRecord::Base
active_admin_translates :title, :text do
#validates_presence_of :title
end
accepts_nested_attributes_for :translations
end