Hi all, looking into ajax support on rails but I can't seem to get
sometime simple to work.

I basically started off with a simple scaffold app, seeded the
database with some dummy data and trying to get delete working as a
ajax request.

rails g scaffold pony name:string profession:string

My delete like looks like this (added remote: true).

<%= link_to 'Destroy', pony, method: :delete, remote: true, class:
'delete_pony' %>

I created a new file: app/views/ponies/destroy.js.erb which I don't
see getting called as I added an alert alert box to check.

$('delete_pony').ajaxSuccess( function() {

My controller method looks like this

   def destroy
     respond_to do |format|
       format.html { redirect_to ponies_url, notice: 'Pony was
successfully destroyed.' }
       format.json { head :no_content }
       format.js { render layout: false }

What am I missing?

Kind Regards,
Rajinder Yadav

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAMRGebgy4JowV7d%3Dk-0akbhONaTeYXOM7w%3DPDVysf%3DGRHh8j5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
grouprubyonrails-talk @
postedApr 9, '16 at 1:03a
activeApr 9, '16 at 4:26p



site design / logo © 2021 Grokbase