Why can't show restaurant list?

后端 未结 3 1560
终归单人心
终归单人心 2020-12-12 08:21

I\'m trying to make some restaurant list. I associated two tables, and then write this code.

class Restaurant < ActiveRecord::Base
        has_many :resta         


        
3条回答
  •  忘掉有多难
    2020-12-12 08:53

    replace

     td = restaurant.restaurant_translations.restaurantname
    

    with

    td = restaurant.restaurant_translations.first.restaurantname
    

    this will help you

提交回复
热议问题