关于where方法的SystemStackError(堆栈级别太深)

时间:2018-04-12 14:56:04

标签: ruby-on-rails

我在调用的地方收到`<ul class="nav-menu"> <li class=""><a href="">About</a></li> <li class=""><a href="">News</a></li> <li class="has_children"><a href="">Events</a> <ul class="sub-menu"> <li><a href="">For Children</a></li> <li><a href="">For Students</a></li> <li><a href="">For Families</a></li> </ul> </li> <li class=""><a href="">Contact</a></li> </ul>`错误。

想知道它是否与关联有关,但不确定。

SystemStackError (stack level too deep)

以下是单个Member对象的样子:

> Member.where(skill_primary: 8)
Traceback (most recent call last):
        1: from (irb):8
SystemStackError (stack level too deep)

会员模特:

#<Member 
  id: 500, 
  name: "Godiva Headache", 
  gender: "", 
  birthdate: "1958-04-12", 
  cost: 0, 
  trait_stamina: 0, 
  trait_ego: 15, 
  trait_looks: 2, 
  trait_drive: 0, 
  trait_productivity: 0, 
  trait_aptitude: 0, 
  trait_creativity: 54, 
  trait_network: 0, 
  trait_fatigue: 0, 
  skill_primary: 8, 
  skill_primary_level: 53, 
  skill_secondary: nil, 
  skill_secondary_level: 0, 
  skill_tertiary: nil, 
  skill_tertiary_level: 0, 
  created_at: "2018-04-12 14:36:46", 
  updated_at: "2018-04-12 14:36:46"
>

技能模型:

class Member < ApplicationRecord
  belongs_to :skill_primary, class_name: 'Skill', foreign_key: :skill_primary
end

在Postgres上运行Rails 5.2。

0 个答案:

没有答案