簡體   English   中英

rails:堆棧級別太深

[英]rails : stack level too deep

實際上我正在進行一個多模型的項目 - >很多。 我需要找到當前用戶所有的信用/設備/項目(我認為只有兩個列(id和score)的表信用是沒用的,所以我將這個表合並到連接表中)。

我收到此錯誤:

SystemStackError in Users#show

Showing app/views/shared/_credit.html.erb where line # raised:

stack level too deep

而這兩個模型:

class **Credit** < ActiveRecord::Base
  attr_accessible :created_at, :credit_id, :device_id, :project_id, :score, :user_id

belongs_to :device
belongs_to :user
belongs_to :project
belongs_to :score

end

class **User** < ActiveRecord::Base

has_many :credit
has_many :credit, :through => :credit, foreign_key: "user_id", dependent: :destroy
end

謝謝 !

最好。

堆棧級別到深度指向一個不定式的遞歸調用,我會說你得到它

has_many :credit, :through => :credit,

這顯然引入了某種循環。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM