Rails 6活动记录 - 使用PG_Search范围和联接后,获得独特/独特的结果?

发布于 2025-02-07 02:27:11 字数 10470 浏览 0 评论 0原文

我正在挣扎着在Rails 6中的活跃记录查询,在那里我加入了两种具有多一关系的模型。

restaurant.rb(提取)

 class Restaurant < ApplicationRecord
    # Associations: Cuisines
    has_many :restaurant_cuisines, dependent: :destroy
    has_many :cuisines, through: :restaurant_cuisines

    # Associations (Location)
    belongs_to :location, foreign_key: 'location_name'
  
    # PgSearch setup
    include PgSearch::Model

    pg_search_scope :search_by_location,
      against: [:location_name],
      using: {
        tsearch: { prefix: true }
      }
 end

也是我们要搜索餐厅的要素之一)

位置

  class Location < ApplicationRecord
     self.primary_key = 'name' # Primary key for this table is name not id
    
     # Restaurant Assocation
     has_many :restaurants, foreign_key: "location_name"
  end

是我们应用程序中的一个模型( > cuisine.rb(提取)

  class Cuisine < ApplicationRecord
     # Associations: Restaurants
     has_many :restaurant_cuisines, dependent: :destroy
     has_many :restaurants, through: :restaurant_cuisines
  end

我正在尝试实施与过滤器的组合搜索,例如

  • 餐厅搜索:仅适用于PG_Search Scope的文本输入,
  • 仅适用于具有与过滤器
  • 结果相匹配的餐厅的餐厅,我认为只想将独特的餐厅展示为结果

,我认为下面的结果应返回2家独特的餐厅(基于测试数据),但它返回0。

Restaurant.search_by_location('bali').joins(:cuisines).order('restaurants.id ASC').distinct

此查询,这是我在Rails Console中看到的输出

  Restaurant Load (0.8ms)  SELECT DISTINCT "restaurants".* FROM "restaurants" INNER JOIN (SELECT "restaurants"."id" AS pg_search_id, (ts_rank((to_tsvector('simple', coalesce("restaurants"."location_name"::text, ''))), (to_tsquery('simple', ''' ' || 'bali' || ' ''' || ':*')), 0)) AS rank FROM "restaurants" WHERE ((to_tsvector('simple', coalesce("restaurants"."location_name"::text, ''))) @@ (to_tsquery('simple', ''' ' || 'bali' || ' ''' || ':*')))) AS pg_search_0dbdc4fb0fbb8e199f1b35 ON "restaurants"."id" = pg_search_0dbdc4fb0fbb8e199f1b35.pg_search_id INNER JOIN "restaurant_cuisines" ON "restaurant_cuisines"."restaurant_id" = "restaurants"."id" INNER JOIN "cuisines" ON "cuisines"."id" = "restaurant_cuisines"."cuisine_id" ORDER BY pg_search_0dbdc4fb0fbb8e199f1b35.rank DESC, "restaurants"."id" ASC, restaurants.id ASC
  Restaurant Load (0.6ms)  SELECT DISTINCT "restaurants".* FROM "restaurants" INNER JOIN (SELECT "restaurants"."id" AS pg_search_id, (ts_rank((to_tsvector('simple', coalesce("restaurants"."location_name"::text, ''))), (to_tsquery('simple', ''' ' || 'bali' || ' ''' || ':*')), 0)) AS rank FROM "restaurants" WHERE ((to_tsvector('simple', coalesce("restaurants"."location_name"::text, ''))) @@ (to_tsquery('simple', ''' ' || 'bali' || ' ''' || ':*')))) AS pg_search_0dbdc4fb0fbb8e199f1b35 ON "restaurants"."id" = pg_search_0dbdc4fb0fbb8e199f1b35.pg_search_id INNER JOIN "restaurant_cuisines" ON "restaurant_cuisines"."restaurant_id" = "restaurants"."id" INNER JOIN "cuisines" ON "cuisines"."id" = "restaurant_cuisines"."cuisine_id" ORDER BY pg_search_0dbdc4fb0fbb8e199f1b35.rank DESC, "restaurants"."id" ASC, restaurants.id ASC LIMIT $1  [["LIMIT", 11]]

如果我删除 查询的后半部分,然后我得到4个结果(每家都有2种美食的2家餐厅)

Restaurant.joins(:cuisines).order('restaurants.id ASC')

,查询的第一部分返回了2个结果,将我的种子

Restaurant.search_by_location('bali')

结合在一起,这是我遇到错误的地方。感谢有关此问题的任何指导。

编辑响应@taras的数据请求

我创建了一些示例数据,我想在这些数据上运行这些查询。我的实际数据具有更多的列,但是如果查询在此示例集上起作用,我可以推断到较大的数据集。

餐厅

Restaurant.all
  Restaurant Load (0.6ms)  SELECT "restaurants".* FROM "restaurants"
=> [#<Restaurant:0x000056116c61fef8 id: 1, name: "la plancha", location: "bali", created_at: Tue, 14 Jun 2022 07:02:56 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:02:56 UTC +00:00>,
 #<Restaurant:0x000056116c61fd68 id: 2, name: "potato head", location: "bali", created_at: Tue, 14 Jun 2022 07:03:04 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:04 UTC +00:00>,
 #<Restaurant:0x000056116c61e1e8 id: 3, name: "milk", location: "bali", created_at: Tue, 14 Jun 2022 07:03:10 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:10 UTC +00:00>,
 #<Restaurant:0x000056116c61dea0 id: 4, name: "black sands", location: "bali", created_at: Tue, 14 Jun 2022 07:03:15 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:15 UTC +00:00>,
 #<Restaurant:0x000056116c61dd10 id: 5, name: "the forge", location: "bali", created_at: Tue, 14 Jun 2022 07:03:29 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:29 UTC +00:00>,
 #<Restaurant:0x000056116c61cd98 id: 6, name: "roast", location: "bangkok", created_at: Tue, 14 Jun 2022 07:03:37 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:37 UTC +00:00>,
 #<Restaurant:0x000056116c61cc08 id: 7, name: "% arabica", location: "bangkok", created_at: Tue, 14 Jun 2022 07:03:47 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:47 UTC +00:00>,
 #<Restaurant:0x000056116c61cb40 id: 8, name: "cocotte", location: "bangkok", created_at: Tue, 14 Jun 2022 07:03:53 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:53 UTC +00:00>,
 #<Restaurant:0x000056116c61c578 id: 9, name: "eat me", location: "bangkok", created_at: Tue, 14 Jun 2022 07:03:59 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:59 UTC +00:00>,
 #<Restaurant:0x000056116c61c438 id: 10, name: "kai", location: "bangkok", created_at: Tue, 14 Jun 2022 07:04:13 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:04:13 UTC +00:00>]

美食

Cuisine.all
  Cuisine Load (0.5ms)  SELECT "cuisines".* FROM "cuisines"
=> [#<Cuisine:0x00007f06247f2ed0 id: 2, name: "european", created_at: Tue, 14 Jun 2022 07:04:37 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:04:37 UTC +00:00>,
 #<Cuisine:0x00007f06247b3550 id: 3, name: "american", created_at: Tue, 14 Jun 2022 07:04:41 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:04:41 UTC +00:00>,
 #<Cuisine:0x00007f06247b3488 id: 4, name: "fusion", created_at: Tue, 14 Jun 2022 07:05:20 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:05:20 UTC +00:00>,
 #<Cuisine:0x00007f06247b3398 id: 1, name: "asian", created_at: Tue, 14 Jun 2022 07:04:27 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:05:42 UTC +00:00>,
 #<Cuisine:0x00007f06247b32a8 id: 5, name: "\ngrilled", created_at: Tue, 14 Jun 2022 07:07:01 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:01 UTC +00:00>]

餐厅美食

RestaurantCuisine.all
  RestaurantCuisine Load (0.4ms)  SELECT "restaurant_cuisines".* FROM "restaurant_cuisines"
=> [#<RestaurantCuisine:0x00007f0624634eb8 id: 1, restaurant_id: 1, cuisine_id: 2, created_at: Tue, 14 Jun 2022 07:06:19 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:19 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c3420 id: 2, restaurant_id: 1, cuisine_id: 1, created_at: Tue, 14 Jun 2022 07:06:23 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:23 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c3330 id: 3, restaurant_id: 2, cuisine_id: 3, created_at: Tue, 14 Jun 2022 07:06:28 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:28 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c3240 id: 4, restaurant_id: 2, cuisine_id: 4, created_at: Tue, 14 Jun 2022 07:06:29 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:29 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c3150 id: 5, restaurant_id: 3, cuisine_id: 1, created_at: Tue, 14 Jun 2022 07:06:34 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:34 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c3088 id: 6, restaurant_id: 3, cuisine_id: 2, created_at: Tue, 14 Jun 2022 07:06:36 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:36 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2fc0 id: 7, restaurant_id: 4, cuisine_id: 3, created_at: Tue, 14 Jun 2022 07:06:42 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:42 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2ef8 id: 8, restaurant_id: 4, cuisine_id: 4, created_at: Tue, 14 Jun 2022 07:06:45 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:45 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2e30 id: 9, restaurant_id: 5, cuisine_id: 5, created_at: Tue, 14 Jun 2022 07:07:12 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:12 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2cf0 id: 10, restaurant_id: 5, cuisine_id: 1, created_at: Tue, 14 Jun 2022 07:07:19 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:19 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2bd8 id: 11, restaurant_id: 6, cuisine_id: 2, created_at: Tue, 14 Jun 2022 07:07:31 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:31 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2ac0 id: 12, restaurant_id: 6, cuisine_id: 3, created_at: Tue, 14 Jun 2022 07:07:33 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:33 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2958 id: 13, restaurant_id: 7, cuisine_id: 4, created_at: Tue, 14 Jun 2022 07:07:39 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:39 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c27c8 id: 14, restaurant_id: 7, cuisine_id: 5, created_at: Tue, 14 Jun 2022 07:07:40 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:40 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2638 id: 15, restaurant_id: 8, cuisine_id: 1, created_at: Tue, 14 Jun 2022 07:07:44 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:44 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c24f8 id: 16, restaurant_id: 8, cuisine_id: 2, created_at: Tue, 14 Jun 2022 07:07:47 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:47 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c22a0 id: 17, restaurant_id: 9, cuisine_id: 3, created_at: Tue, 14 Jun 2022 07:07:51 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:51 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2048 id: 18, restaurant_id: 9, cuisine_id: 4, created_at: Tue, 14 Jun 2022 07:07:53 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:53 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c1e90 id: 19, restaurant_id: 10, cuisine_id: 5, created_at: Tue, 14 Jun 2022 07:07:59 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:59 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c1d00 id: 20, restaurant_id: 10, cuisine_id: 1, created_at: Tue, 14 Jun 2022 07:08:02 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:08:02 UTC +00:00>]

I am struggling with an Active Record query in Rails 6 where I am joining 2 models that have a many-to-many relationship.

Restaurant.rb (extract)

 class Restaurant < ApplicationRecord
    # Associations: Cuisines
    has_many :restaurant_cuisines, dependent: :destroy
    has_many :cuisines, through: :restaurant_cuisines

    # Associations (Location)
    belongs_to :location, foreign_key: 'location_name'
  
    # PgSearch setup
    include PgSearch::Model

    pg_search_scope :search_by_location,
      against: [:location_name],
      using: {
        tsearch: { prefix: true }
      }
 end

Location is a model in our app (and one of the elements that we want to search against for restaurants)

Location.rb (extract)

  class Location < ApplicationRecord
     self.primary_key = 'name' # Primary key for this table is name not id
    
     # Restaurant Assocation
     has_many :restaurants, foreign_key: "location_name"
  end

Cuisine.rb (extract)

  class Cuisine < ApplicationRecord
     # Associations: Restaurants
     has_many :restaurant_cuisines, dependent: :destroy
     has_many :restaurants, through: :restaurant_cuisines
  end

I am trying to implement a combined search with filters, e.g.

  • Search by restaurant location: text input that is passed into a pg_search scope
  • Only for restaurants that have cuisines that match the filters
  • Results are restaurants and only want to show unique restaurants as results

I thought that this result below should return 2 unique restaurants (based on test data) but it returns 0.

Restaurant.search_by_location('bali').joins(:cuisines).order('restaurants.id ASC').distinct

This is the output I see in the Rails console when I run this query

  Restaurant Load (0.8ms)  SELECT DISTINCT "restaurants".* FROM "restaurants" INNER JOIN (SELECT "restaurants"."id" AS pg_search_id, (ts_rank((to_tsvector('simple', coalesce("restaurants"."location_name"::text, ''))), (to_tsquery('simple', ''' ' || 'bali' || ' ''' || ':*')), 0)) AS rank FROM "restaurants" WHERE ((to_tsvector('simple', coalesce("restaurants"."location_name"::text, ''))) @@ (to_tsquery('simple', ''' ' || 'bali' || ' ''' || ':*')))) AS pg_search_0dbdc4fb0fbb8e199f1b35 ON "restaurants"."id" = pg_search_0dbdc4fb0fbb8e199f1b35.pg_search_id INNER JOIN "restaurant_cuisines" ON "restaurant_cuisines"."restaurant_id" = "restaurants"."id" INNER JOIN "cuisines" ON "cuisines"."id" = "restaurant_cuisines"."cuisine_id" ORDER BY pg_search_0dbdc4fb0fbb8e199f1b35.rank DESC, "restaurants"."id" ASC, restaurants.id ASC
  Restaurant Load (0.6ms)  SELECT DISTINCT "restaurants".* FROM "restaurants" INNER JOIN (SELECT "restaurants"."id" AS pg_search_id, (ts_rank((to_tsvector('simple', coalesce("restaurants"."location_name"::text, ''))), (to_tsquery('simple', ''' ' || 'bali' || ' ''' || ':*')), 0)) AS rank FROM "restaurants" WHERE ((to_tsvector('simple', coalesce("restaurants"."location_name"::text, ''))) @@ (to_tsquery('simple', ''' ' || 'bali' || ' ''' || ':*')))) AS pg_search_0dbdc4fb0fbb8e199f1b35 ON "restaurants"."id" = pg_search_0dbdc4fb0fbb8e199f1b35.pg_search_id INNER JOIN "restaurant_cuisines" ON "restaurant_cuisines"."restaurant_id" = "restaurants"."id" INNER JOIN "cuisines" ON "cuisines"."id" = "restaurant_cuisines"."cuisine_id" ORDER BY pg_search_0dbdc4fb0fbb8e199f1b35.rank DESC, "restaurants"."id" ASC, restaurants.id ASC LIMIT $1  [["LIMIT", 11]]

If I remove the second half of the query then I get 4 results (2 restaurants that each have 2 cuisines)

Restaurant.joins(:cuisines).order('restaurants.id ASC')

And the first part of the query returns the 2 results in my seed

Restaurant.search_by_location('bali')

Combining these is where I get my error. Would appreciate any guidance on this issue.

EDIT IN RESPONSE TO @TARAS REQUEST FOR DATA

I created some sample data on which I would like to run these queries. My actual data has more columns but if the query works on this sample set I can extrapolate to the larger dataset.

Restaurants

Restaurant.all
  Restaurant Load (0.6ms)  SELECT "restaurants".* FROM "restaurants"
=> [#<Restaurant:0x000056116c61fef8 id: 1, name: "la plancha", location: "bali", created_at: Tue, 14 Jun 2022 07:02:56 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:02:56 UTC +00:00>,
 #<Restaurant:0x000056116c61fd68 id: 2, name: "potato head", location: "bali", created_at: Tue, 14 Jun 2022 07:03:04 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:04 UTC +00:00>,
 #<Restaurant:0x000056116c61e1e8 id: 3, name: "milk", location: "bali", created_at: Tue, 14 Jun 2022 07:03:10 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:10 UTC +00:00>,
 #<Restaurant:0x000056116c61dea0 id: 4, name: "black sands", location: "bali", created_at: Tue, 14 Jun 2022 07:03:15 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:15 UTC +00:00>,
 #<Restaurant:0x000056116c61dd10 id: 5, name: "the forge", location: "bali", created_at: Tue, 14 Jun 2022 07:03:29 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:29 UTC +00:00>,
 #<Restaurant:0x000056116c61cd98 id: 6, name: "roast", location: "bangkok", created_at: Tue, 14 Jun 2022 07:03:37 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:37 UTC +00:00>,
 #<Restaurant:0x000056116c61cc08 id: 7, name: "% arabica", location: "bangkok", created_at: Tue, 14 Jun 2022 07:03:47 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:47 UTC +00:00>,
 #<Restaurant:0x000056116c61cb40 id: 8, name: "cocotte", location: "bangkok", created_at: Tue, 14 Jun 2022 07:03:53 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:53 UTC +00:00>,
 #<Restaurant:0x000056116c61c578 id: 9, name: "eat me", location: "bangkok", created_at: Tue, 14 Jun 2022 07:03:59 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:03:59 UTC +00:00>,
 #<Restaurant:0x000056116c61c438 id: 10, name: "kai", location: "bangkok", created_at: Tue, 14 Jun 2022 07:04:13 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:04:13 UTC +00:00>]

Cuisines

Cuisine.all
  Cuisine Load (0.5ms)  SELECT "cuisines".* FROM "cuisines"
=> [#<Cuisine:0x00007f06247f2ed0 id: 2, name: "european", created_at: Tue, 14 Jun 2022 07:04:37 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:04:37 UTC +00:00>,
 #<Cuisine:0x00007f06247b3550 id: 3, name: "american", created_at: Tue, 14 Jun 2022 07:04:41 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:04:41 UTC +00:00>,
 #<Cuisine:0x00007f06247b3488 id: 4, name: "fusion", created_at: Tue, 14 Jun 2022 07:05:20 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:05:20 UTC +00:00>,
 #<Cuisine:0x00007f06247b3398 id: 1, name: "asian", created_at: Tue, 14 Jun 2022 07:04:27 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:05:42 UTC +00:00>,
 #<Cuisine:0x00007f06247b32a8 id: 5, name: "\ngrilled", created_at: Tue, 14 Jun 2022 07:07:01 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:01 UTC +00:00>]

RestaurantCuisines

RestaurantCuisine.all
  RestaurantCuisine Load (0.4ms)  SELECT "restaurant_cuisines".* FROM "restaurant_cuisines"
=> [#<RestaurantCuisine:0x00007f0624634eb8 id: 1, restaurant_id: 1, cuisine_id: 2, created_at: Tue, 14 Jun 2022 07:06:19 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:19 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c3420 id: 2, restaurant_id: 1, cuisine_id: 1, created_at: Tue, 14 Jun 2022 07:06:23 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:23 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c3330 id: 3, restaurant_id: 2, cuisine_id: 3, created_at: Tue, 14 Jun 2022 07:06:28 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:28 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c3240 id: 4, restaurant_id: 2, cuisine_id: 4, created_at: Tue, 14 Jun 2022 07:06:29 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:29 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c3150 id: 5, restaurant_id: 3, cuisine_id: 1, created_at: Tue, 14 Jun 2022 07:06:34 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:34 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c3088 id: 6, restaurant_id: 3, cuisine_id: 2, created_at: Tue, 14 Jun 2022 07:06:36 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:36 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2fc0 id: 7, restaurant_id: 4, cuisine_id: 3, created_at: Tue, 14 Jun 2022 07:06:42 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:42 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2ef8 id: 8, restaurant_id: 4, cuisine_id: 4, created_at: Tue, 14 Jun 2022 07:06:45 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:06:45 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2e30 id: 9, restaurant_id: 5, cuisine_id: 5, created_at: Tue, 14 Jun 2022 07:07:12 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:12 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2cf0 id: 10, restaurant_id: 5, cuisine_id: 1, created_at: Tue, 14 Jun 2022 07:07:19 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:19 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2bd8 id: 11, restaurant_id: 6, cuisine_id: 2, created_at: Tue, 14 Jun 2022 07:07:31 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:31 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2ac0 id: 12, restaurant_id: 6, cuisine_id: 3, created_at: Tue, 14 Jun 2022 07:07:33 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:33 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2958 id: 13, restaurant_id: 7, cuisine_id: 4, created_at: Tue, 14 Jun 2022 07:07:39 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:39 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c27c8 id: 14, restaurant_id: 7, cuisine_id: 5, created_at: Tue, 14 Jun 2022 07:07:40 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:40 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2638 id: 15, restaurant_id: 8, cuisine_id: 1, created_at: Tue, 14 Jun 2022 07:07:44 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:44 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c24f8 id: 16, restaurant_id: 8, cuisine_id: 2, created_at: Tue, 14 Jun 2022 07:07:47 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:47 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c22a0 id: 17, restaurant_id: 9, cuisine_id: 3, created_at: Tue, 14 Jun 2022 07:07:51 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:51 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c2048 id: 18, restaurant_id: 9, cuisine_id: 4, created_at: Tue, 14 Jun 2022 07:07:53 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:53 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c1e90 id: 19, restaurant_id: 10, cuisine_id: 5, created_at: Tue, 14 Jun 2022 07:07:59 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:07:59 UTC +00:00>,
 #<RestaurantCuisine:0x00007f06245c1d00 id: 20, restaurant_id: 10, cuisine_id: 1, created_at: Tue, 14 Jun 2022 07:08:02 UTC +00:00, updated_at: Tue, 14 Jun 2022 07:08:02 UTC +00:00>]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文