Rails: HasManyThroughAssociationNotFoundError Rails: HasManyThroughAssociationNotFoundError ruby ruby

Rails: HasManyThroughAssociationNotFoundError


You need to add

has_many :entries

To each of your models, since the :through option just specifies a second association which it should use to find the other side.


You would need to add

has_many :entries

To each model, and above has_many :through, like this:

class Article < ActiveRecord::Base  has_many :entries  has_many :warehouses, :through => :entriesendclass Warehouse < ActiveRecord::Base  has_many :entries  has_many :articles, :through => :entriesend

More detailed tutorial on how to handle view and controllers https://kolosek.com/rails-join-table/


@Meekohi This means that you have no Entry model. I just received the error message myself, so wanted to point it out (can't post it as a comment due to low reputation).

class Entry < ActiveRecord::Base  belongs_to :article  belongs_to :warehouseend

Simply run

rails g model Entry