while population sub category dropdown receive below error active admin

只愿长相守 提交于 2020-04-30 08:46:47

问题


Error:-

ActionView::MissingTemplate (Missing template admin/blogs/get_child_category, active_admin/resource/get_child_category, active_admin/base/get_child_category, inherited_resources/base/get_child_category, application/get_child_category with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :vcf, :vtt, :png, :jpeg, :gif, :bmp, :tiff, :svg, :mpeg, :mp3, :ogg, :m4a, :webm, :mp4, :otf, :ttf, :woff, :woff2, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip, :gzip], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :arb, :jbuilder]}. Searched in:
  * "/home/rakesh/Documents/codetoart-website/app/views"

admin/category.rb

 form do |f|
    f.inputs do

       .....

      f.input :Category,:input_html => {
        :onchange => remote_request(:post, :get_child_category, {:child_category_id=>"$('#blog_category_id').val()"}, :child_category_id)
      }
      f.input :child_category_id
       .....
    end
    f.actions
  end

method:-

 controller do
    def get_child_category
      @child_category = Category.where(:parent_id => params[:child_category_id])
      render :text=>view_context.options_from_collection_for_select(@child_category, :id, :name)
    end
  end

application_helper.rb

 def remote_request(type, path, params={}, target_tag_id)
        "$.#{type}('#{path}',
                   {#{params.collect { |p| "#{p[0]}: #{p[1]}" }.join(", ")}},
                   function(data) {$('##{target_tag_id}').html(data);}
         );"
    end

is there any solution? as it's not population sub category dropdown.

来源:https://stackoverflow.com/questions/60700802/while-population-sub-category-dropdown-receive-below-error-active-admin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!