Warum kann die Liste der Restaurants nicht angezeigt werden?
Ich versuche eine Restaurantliste zu machen. Ich habe zwei Tabellen zugeordnet und dann diesen Code geschrieben.
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
list.html.slim table thead tr. Typ. Name. URL. Genre. Adr.
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
Aber Ergebnisse sind unten. "undefinierte Methode restaurantname für #"
Wie kann ich dieses Problem lösen? Danke im Voraus