Hi,
I’m currently using the latest version of rails 2.0.2 with cookies.
My problem is as follows, to which I’ve not found any help on google
etc.
I have a page which presents the user with two drop-down menus. The
first one, for example, asks for a car manufacurer, and the second,
which by default is blank, will ask for the model. Within my view I
use the following
<%= collection_select(:manufacturer, :manufacturer_id,
@manufacturers, :id, :description, options ={:prompt => “-Select a
Manufacturer”},
{
:onChange => “new Ajax.Updater(‘manufacturer_model_id’, ‘/
models/list_by_manufacturer_id/’+ this[this.selectedIndex].value,
{asynchronous:true, evalScripts:true})”
}
) %>
<%= collection_select(:manufacturer, :model_id,
@models, :id, :description, options ={:prompt => “-Select a model”})%>
The above works fine. When I choose a manufacturer from the first
selection it fires the js but rails then returns an error:
ActionController::InvalidAuthenticityToken
in ModelController#list_by_manufacturer_id
I believe the problem might be because I need to pass the
authenticity_token as part of the request, though I’m not sure, and if
so I’m uncertain as to how I go about passing it within the ajax call.
Any help/direction would be greatly appreciated