simple_form_for and simple_form_with

235 views
Skip to first unread message

Roy Nyaga

unread,
Nov 6, 2019, 6:31:23 AM11/6/19
to SimpleForm
I realized the simple form tag does not work with the form_with rails 5.1 helper method, following the form_for convention of creating a simple_form_for helper method to implement simple form syntax, i thought simple_form_with would behave the same but it raised an error of undefined method. Given that rails is gradually switching from form_for and form_tag to form_with, is there any way to implement simple forms on a form_with helper? example
<%= simple_form_with(model: post, local: true) do |form| %>
        <%= f.error_notification %>
        <div class="form-inputs">
            <%= f.input :content, placeholder: "whats on your mind?", label: false %>               
        </div>
        <div class="form-actions">
            <%= f.button :submit, "create post" %>
        </div>
    <% end %> 

instead of 
<%= simple_form_for(model: post, local: true) do |form| %>
        <%= f.error_notification %>
        <div class="form-inputs">
            <%= f.input :content, placeholder: "whats on your mind?", label: false %>               
        </div>
        <div class="form-actions">
            <%= f.button :submit, "create post" %>
        </div>
    <% end %> 

Reply all
Reply to author
Forward
0 new messages