Undefined method `remote_function '

I am using rails-3.2.1 with blacklight app

I am trying to call remote_function in the link_to tag.

<%= link_to_document document, :label=>document_show_link_field, :onclick =>     remote_function(:controller => 'catalog', :action => 'save_user_history') %>

This gives the following error

undefined method `remote_function' for #<#<Class:0x2ff0dc0>:0x2f4af38>.

Does anyone know why?

+5
source share
2 answers

This feature was part of the prototype helper , which was removed from the Framework with Rails 3.1 and moved to the prototype rails example .

+5
source

You can always use regular link_to.

<%= link_to "Save User History", save_user_history_catalogs_path %>

Or, if it is an ajax function, something like this:

<a id="save_user_history">Save User History</a>

And in your javascript file:

$("#save_user_history").click(function() {
  $.post("/catalogs/save_user_history", function(data) {
    ....
+2
source

All Articles