ruby on rails - Rerun JavaScript on successful ajax call -
i have delete button remote: true option set: # _categories.html.erb <%= link_to 'destroy', category, method: :delete, data: { confirm: 'are sure?' }, remote: true %> my destroy method uses json: # categories_controller.rb def destroy @category = admin::category.find(params[:id]) @category.destroy save_to_history("the category \"#{@category.name}\" has been destroyed", current_user.id) respond_to |format| # can't retrieve @categories before attempting delete one. @categories = admin::category.all format.json end end and destroy.json.erb file looks like: #destroy.json.erb <% self.formats = ["html"] %> { "html":"<%= raw escape_javascript( render :partial => 'categories', :content_type => 'text/html') %>" } now problem have javascript run on page load, , deleting initial category works intended... until data changes. n...