Rails 3.1.1
活动管理员 0.4.4
格式 2.1.1
这是我Agency
模型的活动管理控制器。
ActiveAdmin.register Agency do
form do |f|
f.input :name
f.input :contact_email, :label=>"Email invoices to"
f.input :api_key, :hint=>"Create a key by following <a href=\"#\" target=\"_blank\">these instructions</a>".html_safe
f.actions
end
end
表单应该呈现三个输入,然后是提交按钮,但我得到的只是:
为了清楚起见,HTML 没有显示缺少输入的迹象:
<form accept-charset="UTF-8" action="/admin/agencies" class="formtastic agency" id="agency_new" method="post" novalidate="novalidate" name="agency_new">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="...">
</div>
<fieldset class="actions">
<ol>
<li class="action input_action" id="agency_submit_action">
<input name="commit" type="submit" value="Create Agency">
</li>
</ol>
</fieldset>
</form>
我还尝试使用具有相同(错误)输出的字段集:
ActiveAdmin.register Agency do
form do |f|
f.inputs "New Agency" do
f.input :name
f.input :contact_email, :label=>"Email invoices to"
f.input :api_key, :hint=>"Create a key by following <a href=\"#\" target=\"_blank\">these instructions</a>".html_safe
end
f.actions
end
end
更新:我发现注释掉该f.actions
行会很容易打印输入,但现在只是没有按钮。
ActiveAdmin.register Agency do
form do |f|
f.inputs "New Agecny" do
f.input :name
f.input :contact_email, :label=>"Email invoices to"
f.input :api_key, :hint=>"Create a key by following <a href=\"#\" target=\"_blank\">these instructions</a>".html_safe
end
#f.actions
end
end
有输入但没有按钮的表单: