0

I've upgraded to rails 6.1 from rails 6.0 and trying out Hotwire, but I am getting an error when trying to run my application:

wrong number of arguments (given 0, expected 1..4)
Extracted source (around line #1):
  <%= turbo_frame_tag 'branch' do %> 

my code in my edit.html.erb:

<%= turbo_frame_tag 'post' do %> 
   <h3>Edit post</h3>
       <%= render 'form', post: @post %>
<% end %>

my code in my _form.html.erb:

<%= form_with(model: post, local: true) do |form| %>
  <% if post.errors.any? %>
    <h5><%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:</h5>
      <ul class="browser-default">
        <% post.errors.full_messages.each do |message| %>
          <li><%= message %></li>
        <% end %>
      </ul>
  <% end %>

  <div class="form-field">
    <div class="input-field">
      <%= form.text_field :title %>
      <%= form.label :title %>
    </div>
  </div>

  <br>

  <div class="form-field">
    <div class="input-field">
      <%= form.text_field :description %>
      <%= form.label :description %>
    </div>
  </div>


  <div class="actions"><%= submit_tag "Submit", :type=>"submit", :class=>"btn", :data => { :disable_with => "Processing" } %></div>
<% end %>

my code in my show.html.erb:

<%= turbo_frame_tag 'branch' do %> 
   <h3><%= @post.title %></h3>
   <p><%= @post.description %></p>
<% end %>

Does anybody have an idea what I might have missed during the upgrade process? I ran rails turbo:install and also rails hotwire:install or am I missing something in the turbo frame tag?

doer123456789
  • 369
  • 1
  • 7
  • 22
  • Your turbo_frame_tag looks fine. What happens if you get rid of the block ? Just <%= turbo_frame_tag 'branch' %> to see what happens – Joel Blum Apr 20 '21 at 17:50
  • @Joel_Blum same error – doer123456789 Apr 20 '21 at 18:00
  • Can you share more of the stack trace? clearly you're passing an argument so hard to see whats going on – Joel Blum Apr 20 '21 at 18:29
  • 1
    FWIW I got stuck on that error message for a couple days because I had included the Rails url helpers incorrectly somewhere (this line: `include Rails.application.routes.url_helpers`). Removing that `include` made the error go away. – aidan May 16 '21 at 22:13
  • 1
    @AidanMiles Thank you very much, I was also struggling with this issue and your answer helped me to fix the issue. – Vickyonit Aug 25 '21 at 06:21

0 Answers0