I’ve been trying out the newly released Rails 2.0. Lots of cool new stuff. However, it takes some time to get used to doing things the new way if you haven’t been working from EdgeRails.
One of the features that came out of the box in previous releases was support for autocomplete using scriptaculous. This has now been moved from the core rails install to an install via plugin.
Just install the plugin via:
script/plugin install http://svn.rubyonrails.org/rails/plugins/auto_complete
Then, you have to turn off the cross-site request forgery protection that comes with Rails 2.0.
You can do this at the Controller level by adding something similar to the following:
class UsersController < ApplicationController protect_from_forgery :only => [:update, :delete, :create] // exclude the auto_complete method ... end
If you don’t do this, your autocomplete actions will throw an ActionController::InvalidAuthenticityToken exception which caused me hours of confusion.
Thank you very much 🙂
No problem, I’m glad my confusion resulted in something good 🙂