Frage

I'm getting into Ajax, obviously using Prototype, and just getting to the point of switching from link_to to link_to_remote (because I want to make a background request of the server). The problem? The server claims that link_to_remote is not defined. I keep reading that all you need to do is make sure that prototype is defined thus:

<%= javascript_include_tag "prototype" %> (I've included it in the application.html.erb file)

I still had link_to_remote undefined, and anyway I couldn't figure out how including javascript would define helper code, so I added actionpack to my Gemfile. It successfully installed, I have a good path for it, I rebooted rails server, and link_to_remote is STILL undefined.

War es hilfreich?

Lösung

I'm assuming you're using Rails 3.0.x running into this issue.

link_to_remote is deprecated in favor of link_to 'Foobar', foobar_path, :remote => true.

You probably want to jump on the jQuery bandwagon. Rails 3.1 ships with jQuery by default, and I'm sure future versions will too (for a while at least).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top