我有一个带有加载模式的简单应用程序我添加了Active Admin gem并且它工作得很好但是当我尝试从Active Admin UI编辑加载但它没有显示我的某些字段的下拉列表:{ {3}}
我的加载表格
<div class="form-row">
<div class="field">
<%= f.input :name, label: "Tittle", placeholder: 'Give A Tittle To Your Shipment' %>
</div>
</div>
<div class="form-row">
<div class="field">
<%= f.input :description, label: "Description", placeholder: 'Define Your Shipment' %>
</div>
</div>
<div class="pickup">
<div class="form-row">
<div class="field">
<span class="fa fa-map-marker"></span>
<%= f.input :from, :collection => ["Kolkata"],
:input_html => {:class => 'selectpicker'}, :label => 'Pickup (City)', :prompt => 'Select Pickup City' %>
</div>
</div>
</div>
<div class="delivery">
<div class="form-row">
<div class="field">
<span class="fa fa-map-marker"></span>
<%= f.input :to, :collection => ["Kolkata", "Mumbai", "Delhi"],
:input_html => {:class => 'selectpicker'}, :label => 'Delivery (City)', :prompt => 'Select Delivery City' %>
</div>
</div>
</div>
admin_user.rb
class AdminUser < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
end
货件型号
class Shipment < ActiveRecord::Base
include PublicActivity::Model
tracked owner: ->(controller, model) { controller && controller.current_user }
acts_as_votable
belongs_to :user
has_many :comments, :dependent => :delete_all
has_attached_file :image, styles: { medium: "300x300#" }, :default_url => "missing.jpg"
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
end
有效模式发货模式
ActiveAdmin.register Shipment do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
permit_params :list, :of, :attributes, :on, :model, :name, :description, :from, :to, :date, :pay, :status, :image
#
# or
#
# permit_params do
# permitted = [:permitted, :attributes]
# permitted << :other if resource.something?
# permitted
# end
end
答案 0 :(得分:0)
我想你忘了添加:as =&gt;选择 示例代码如下:
<script>
$(document).ready(function() {
{% for a in all_results %}
$('#{{a.set|slice:":7"}}_{{ a.item }}_{{ a.kidu|slice:":2" }}').html('<a class="a1" href="{% url 'req_detail_view' a.id %}">{{ a.id }}</a>');
$('#{{a.set|slice:":7"}}_{{ a.item}}_{{ a.kidu|slice:":2" }}').addClass('{{ a.state__name.split|join:"_" }}');
{% endfor %}
});
</script>