Имеется следующая форма:
= simple_form_for Message.new do |f|
= f.input :body, as: :text
= f.submit
Генерируется следующий HTML:
<form novalidate="novalidate" class="simple_form new_message" id="new_message" action="/messages" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓">
<input type="hidden" name="authenticity_token" value="2d0pBcQTcmVOjV5UG8VwNPg74t65dYd0lnWNLoQC2NIqirzuf0ZzTga6oTwLKtbVmPzf1qOoKyGMEZxUdnkyuA==">
<div class="input text required message_body">
<label class="text required" for="message_body">
<abbr title="required">*</abbr> Body</label>
<textarea class="text required" name="message[body]" id="message_body"></textarea>
</div>
<input type="submit" name="commit" value="Create Message">
</form>
Но если добавить
remote: true
, то форма становится такого вида:
<form novalidate="novalidate" class="simple_form new_message" id="new_message" action="/messages" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓">
<div class="input text required message_body">
<label class="text required" for="message_body">
<abbr title="required">*</abbr> Body</label>
<textarea class="text required" name="message[body]" id="message_body"></textarea>
</div>
<input type="submit" name="commit" value="Create Message">
</form>
И появляется ошибка
ActionController::InvalidAuthenticityToken