Using a :partial for the start of a "form_tag" and the "end" in a different :partial gave
"compile error" and "syntax err开发者_C百科or, unexpected kENSURE, expecting kEND".
Changing the "form_tag" to a standard HTML "form" tag fixes that but gives "ActionController::InvalidAuthenticityToken".
Adding
<%= token_tag %>
just after the HTML form tag fixes issue.
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.
精彩评论