Я использую активного администратора с ActiveResource, но не могу иметь поле ввода, так как search_select всегда пытается выполнить поиск из модели ActiveResource.
ActiveAdmin.register DriverPricing, sort_order: 'id_desc' do
.
.
.
f.input :limoCompanyId,
as: :search_select,
url: '/limo_companies',
fields: %w[id],
display_name: 'id name',
minimum_input_length: 2
Ниже приведены некоторые классы, определенные в проекте
class DriverPricing < ActiveResource::Base
end
ActiveAdmin.register LimoCompany, sort_order: 'id_desc' do
end
class LimoCompany < ApplicationRecord
end
Сообщение об исключении
undefined method `name' for #<DriverPricing:0x00007fe9d6138928>
Трассировка исключения
activeresource (5.0.0) lib/active_resource/base.rb:1613:in `method_missing'
vendor/gems/activeadmin_addons/lib/activeadmin_addons/support/input_helpers/select_helpers.rb:47:in `item_to_select_option'
vendor/gems/activeadmin_addons/lib/activeadmin_addons/support/input_helpers/select_helpers.rb:21:in `initial_collection_to_select_options'
vendor/gems/activeadmin_addons/app/inputs/search_select_input.rb:7:in `render_custom_input'
vendor/gems/activeadmin_addons/lib/activeadmin_addons/support/input_base.rb:10:in `to_html'
formtastic (3.1.5) lib/formtastic/helpers/input_helper.rb:242:in `input'
vendor/gems/activeadmin_addons/lib/activeadmin_addons/support/enumerize_formtastic_support.rb:13:in `input'
arbre (1.1.1) lib/arbre/rails/forms.rb:30:in `proxy_call_to_form'
activeadmin (1.3.1) lib/active_admin/views/components/active_admin_form.rb:65:in `input'
app/admin/driver_pricing.rb:186:in `block (3 levels) in <top (required)>'
activeadmin (1.3.1) lib/active_admin/views/components/active_admin_form.rb:53:in `block (2 levels) in inputs'
actionview (5.2.1) lib/action_view/helpers/capture_helper.rb:41:in `block in capture'
actionview (5.2.1) lib/action_view/helpers/capture_helper.rb:205:in `with_output_buffer'
actionview (5.2.1) lib/action_view/helpers/capture_helper.rb:41:in `capture'
activeadmin (1.3.1) lib/active_admin/views/components/active_admin_form.rb:52:in `block in inputs'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.1.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.1.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
Даже удаление имени из display_name дает тот же результат