views:

175

answers:

2

Using a :partial for the start of a "form_tag" and the "end" in a different :partial gave

"compile error" and "syntax error, unexpected kENSURE, expecting kEND".

Changing the "form_tag" to a standard HTML "form" tag fixes that but gives "ActionController::InvalidAuthenticityToken".

A: 

Adding

<%= token_tag %>

just after the HTML form tag fixes issue.

Straff
A: 

This is because form_tag is a block and the end must be contained in the same file. For example, the following code is impossible:

foo.rb

 def some_method
   puts "test"
 require 'end'

end.rb

 end

This is due the order in which the code is evaluated.

Ryan Bigg