amatsuda / jb

A simple and fast JSON API template engine for Ruby on Rails
MIT License
1.29k stars 43 forks source link

Rails 6.0.0.beta3: render partial: wrong number of arguments (given 2, expected 0) #28

Closed olegantonyan closed 5 years ago

olegantonyan commented 5 years ago

layouts/application.html.erb

<html>
  <head>
    <title><%= app_title + (content_for?(:page_title) ? ' | ' + yield(:page_title) : '') %></title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <%= csrf_meta_tags %>
    <%= stylesheet_pack_tag 'application' %>
    <%= content_tag :div, hidden: true, id: "js_data", js_data: @js_data.to_json do %>
    <% end %>
    <%= content_for?(:js) ? yield(:js) : javascript_packs_with_chunks_tag('application') %>
  </head>
  <body>
    <% unless hide_navbar? %>
      <%= render 'layouts/navbar' %>
    <% end %>

    <section class="section">

      <div class="container">
        <%= yield %>
        <%= render 'layouts/footer' %>
      </div>

    </session>
  </body>
</html>

This causes an error in rails 6.0.0.beta3:

ActionView::Template::Error (wrong number of arguments (given 2, expected 0)):
    11:   </head>
    12:   <body>
    13:     <% unless hide_navbar? %>
    14:       <%= render 'layouts/navbar' %>
    15:     <% end %>
    16: 
    17:     <section class="section">

Can be reproduced on a fresh new app rails _6.0.0.beta3_ new test_render example: https://github.com/olegantonyan/jb_render_bug

peterxjang commented 5 years ago

I believe this has been fixed with the most recent commits (although it's not released yet on Ruby gems as of 3/25/19). You can use this in your Gemfile as a temporary fix: gem 'jb', git: 'https://github.com/amatsuda/jb'