wyde19 wyde19 - 4 months ago 18x
jQuery Question

ActiveAdmin js response

Where do I create view for JS response?
Currently, I have jquery-fileupload and the simple script

$ ->
$('#stone_cover').fileupload({dataType: 'script'})

,which uploads some file in form.
I googled, like, 3 hours and didnt found, how to define your own JS response, preferably as .js.erb file for activeadmin to use.
I tried app/views/admin/model_name_pluralized/action, tried different names, but nothing is working.
Does anybody know, what actually I have to do?


Ok, I did it like that:

controller do
  super do |format|
    [your normal controller logic with params etc]
    format.js {render 'path/to/your/view'}

It seems, this is the only way to render your js view through ActiveAdmin.