在开发过程中一切正常,但在生产中,它会在新的和编辑操作中中断。这是生产日志:
.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bundler/gems/activeadmin-5a2b7b5bc683/app/views/active_admin/resource/new.html.arb (191.9ms)
I, [2015-07-31T10:51:31.326590 #26202] INFO -- : Completed 500 Internal Server Error in 254ms
F, [2015-07-31T10:51:31.329305 #26202] FATAL -- :
ActionView::Template::Error (too many arguments for format string):
1: insert_tag renderer_for(:new)
app/admin/business.rb:51:in `block (3 levels) in <top (required)>'
app/admin/business.rb:36:in `block (2 levels) in <top (required)>'
我的商业模式:
has_many :business_attributes, dependent: :destroy
accepts_nested_attributes_for :business_attributes, allow_destroy: true, reject_if: :all_blank
我的BusinessAttribute模型:
belongs_to :business
ActiveAdmin:
ActiveAdmin.register Business do
form(allow_destroy: true, html: { multipart: true }) do |f|
...other_fields..
f.has_many :business_attributes do |attribute|
attribute.input :name
attribute.input :value
end
f.actions
end
permit_params :param, :param, ....
end
我正在使用activeadmin&#39; 1.0.0.pre1&#39;使用rails 4.2.0我的生产堆栈是nginx和独角兽,如果这有帮助。欢迎任何评论和回复。感谢。
答案 0 :(得分:0)
希望您可以使用稳定版本的activeadmin作为推荐
你可以试试这个
form :html => { :enctype => "multipart/form-data" } do |f|
并且还放
f.has_many :business_attributes do |attribute|
attribute.input :_destroy, :as => boolean
attribute.input :name
attribute.input :value
正如您的模型已经
accepts_nested_attributes_for :business_attributes, allow_destroy: true
答案 1 :(得分:0)
虽然我无法解决activeadmin问题。但是我找到了解决问题的方法(它无法从关系中构建表单)。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Provides the `snippet` object, see http://meta.stackexchange.com/a/242144/134069 -->
<script src="http://tjcrowder.github.io/simple-snippets-console/snippet.js"></script>
<p class="question_description">
question to test autolinker
<br>
<br>
<a class="que_desc_cat_span" href="/category?category=Technology">Technology</a>
</p>
渲染表单部分修复了该问题。我使用coocon gem来嵌套属性。
希望它可以帮助他人。