ActiveAdmin ActiveResource search_select












0















I am using active admin with ActiveResource but unable to have input field as search_select it always try to search from ActiveResource model.



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


Following are some classes defined in project



class DriverPricing < ActiveResource::Base
end

ActiveAdmin.register LimoCompany, sort_order: 'id_desc' do
end

class LimoCompany < ApplicationRecord
end


Exception message



undefined method `name' for #<DriverPricing:0x00007fe9d6138928>


Exception Trace



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'


Even removing name from display_name gives same result










share|improve this question





























    0















    I am using active admin with ActiveResource but unable to have input field as search_select it always try to search from ActiveResource model.



    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


    Following are some classes defined in project



    class DriverPricing < ActiveResource::Base
    end

    ActiveAdmin.register LimoCompany, sort_order: 'id_desc' do
    end

    class LimoCompany < ApplicationRecord
    end


    Exception message



    undefined method `name' for #<DriverPricing:0x00007fe9d6138928>


    Exception Trace



    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'


    Even removing name from display_name gives same result










    share|improve this question



























      0












      0








      0








      I am using active admin with ActiveResource but unable to have input field as search_select it always try to search from ActiveResource model.



      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


      Following are some classes defined in project



      class DriverPricing < ActiveResource::Base
      end

      ActiveAdmin.register LimoCompany, sort_order: 'id_desc' do
      end

      class LimoCompany < ApplicationRecord
      end


      Exception message



      undefined method `name' for #<DriverPricing:0x00007fe9d6138928>


      Exception Trace



      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'


      Even removing name from display_name gives same result










      share|improve this question
















      I am using active admin with ActiveResource but unable to have input field as search_select it always try to search from ActiveResource model.



      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


      Following are some classes defined in project



      class DriverPricing < ActiveResource::Base
      end

      ActiveAdmin.register LimoCompany, sort_order: 'id_desc' do
      end

      class LimoCompany < ApplicationRecord
      end


      Exception message



      undefined method `name' for #<DriverPricing:0x00007fe9d6138928>


      Exception Trace



      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'


      Even removing name from display_name gives same result







      ruby-on-rails ruby activeadmin activeresource






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 8 '18 at 9:29







      Umair Ejaz

















      asked Oct 6 '18 at 21:46









      Umair EjazUmair Ejaz

      1431115




      1431115
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52683609%2factiveadmin-activeresource-search-select%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52683609%2factiveadmin-activeresource-search-select%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Lugert, Oklahoma