Search code examples
ruby-on-railsrubyvue.js

How to use the Rails form tags helper with Vuejs?


My form helper

<%= form_with(url: '/add', method: 'post') do %>
   <%= text_field_tag('name', nil) %>
   <%= submit_tag('Add', disable: 'true') %>
<%end%>

generates

<form action="/add" accept-charset="UTF-8" data-remote="true" method="post">   
    <input type="hidden" name="authenticity_token" value="a/5xfluAjw...Xb3wY5r+Fg==" />
    <input type="text" name="name" id="name" />
    <input type="submit" name="commit" value="Add" disable="true" data-disable-with="Add" />
</form>
  1. It's fine but with vuejs I need to get v-bind:disable="true" or :disable="true" rather than disable="true" How to get this with the form helpers without getting an ActionView::SyntaxErrorInTemplate ?

  2. I don't think I need data-disable-with="Add" ?

Thank you for your help :)


Solution

  • I find the solution I wrote :"v-bind:disable" => 'true' and now it's working

    Thank you for your help