Actually i'm on a project for a model many->many. I need to find with a current user all credits/devices/project (and I think it's useless to have a table credit with only two column (id & score) so I merge this table to the join table).
I get this error :
SystemStackError in Users#show
Showing app/views/shared/_credit.html.erb where line # raised:
stack level too deep
And the two model :
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
Thank !
Best.
Stack level to deep points to an infinitive recursive call, and I would say you get that with
has_many :credit, :through => :credit,
which clearly introduces a cycle of some sort.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With