I have two JSON file in my rails project
index.json.jbuilder
json.array! @restaurants, partial: 'restaurants/restaurant', as: :restaurant
and _restaurant.json.jbuilder
json.(restraurant, :id, :name, :address, :description)
When i render my component on my index.html.erb
<%= react_component('RestaurantList', {name: raw(render(template: 'restaurants/index.json.jbuilder')) }) %>
I get this error.
NameError in Restaurants#index
undefined local variable or method `restraurant' for #<#<Class:0x007ffd1f6a61b0>:0x007ffd22e2bea0>
Did you mean? restaurant
restaurant_url
restaurant_path
restaurants_url
restaurants_path
@restaurants
Extracted source (around line #1):
1
json.(restraurant, :id, :name, :address, :description)
any idea ?