Blog » Blog Entry

ActionController::InvalidAuthenticityToken with observe_field

December 31, 2007

I found another Rails 2.x gotcha. Seems one is required to add a form_authenticity_token to observe_field manually, otherwise you get ActionController::InvalidAuthenticityToken in production mode.

<%= observe_field 'search_term',
                  :frequency => 0.5,
                  :update    => 'target_id',
                  :url       => { :controller              => 'search',
                                  :action                  => 'search',
                                  :form_authenticity_token => form_authenticity_token },
                  :with       => "'search=' + escape(value)",
                  :loading    => "Element.show( 'wait' );",
                  :complete   => "Element.hide( 'wait' );" %>
Tags: rubyonrails, observe_field

« Play with Perl6 on Mac OS X Leopard Cats are Macbook Pro users too! »

Add a comment:

Title:

Comment:

Name:

Email: