In your link_to declaration, add remote: true in the options, and in your controller, add a handler for format.js alongside the format.html in the respond_to block. In that handler's block, tell it what to do. The simplest thing is to render a follow.js.erb, which can contain any JavaScript you like to note to the user that the follow event happened. Change the text of the button to "Following" for example. Add and remove a CSS class to "flash" the button or whatever else makes sense to your users.
Walter On Jul 10, 2015, at 11:03 PM, David Williams <[email protected]> wrote: > I'm in need of the AJAX method that allows a person to follow without > rendering a view. > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/b8a03e773f44e67af5e2a7acbdaaa0f9%40ruby-forum.com. > For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/A7DB49D3-F46A-429F-A94E-F193D6E1C47C%40wdstudio.com. For more options, visit https://groups.google.com/d/optout.

