Home > database >  Rails 7 missing partial
Rails 7 missing partial

Time:02-11

I am upgrading to Rails 7.1 and get a weird error in a view using a JS partial:

Missing partial account/_stripe.js.erb, application/_stripe.js.erb with {:locale=>[:fr], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}.

Here is my code to render the partial (it works well with Rails 6):

<%= render "stripe.js.erb" %>

The partial is located in the same folder as the view and is named "_stripe.js.erb".

I tried to replace the name of the partial, as suggested, by account/stripe, account/stripe.js, account/stripe.js.erb, stripe, stripe.js, none works.

Any idea how to solve this with Rails 7? Thanks.

CodePudding user response:

Having an extension in the partial name was deprecated in Rails 6.1 and removed in Rails 7. You should use the following syntax:

<%= render partial: 'stripe', formats: :js %>
  • Related