Por que não pode mostrar a lista de restaurantes?
Estou tentando fazer uma lista de restaurantes. Associei duas tabelas e depois escrevi esse código.
class Restaurant < ActiveRecord::Base
has_many :restaurant_translations
end
class RestaurantTranslation < ActiveRecord::Base
self.table_name = 'restaurant_translations'
end
restaurant_controller.rb
class RestaurantController < ApplicationController
def list
@restaurants = Restaurant.all
logger.debug @restaurants
end
end
tabela list.html.slim tabela th Tipo th Nome th Url th Gênero th Addr
tbody
- @restaurants.each do |restaurant|
tr
td = restaurant.restaurant_type
td = restaurant.restaurant_translations.restaurantname
td = link_to 'here', restaurant.url
td = restaurant.genre
td = restaurant.restaurant_translations.address
Mas os resultados são belows. "método indefinido` restaurantname 'para # "
Como posso resolver este problema? Desde já, obrigado.