ActiveRecord::HasManyThroughAssociation NotFoundError – Ruby on Rails

I ran into a bit of a problem with a has_many relationship in rails today:

ActiveRecord::HasManyThroughAssociationNotFoundError in FeedbacksController#index

Could not find the association :sub_orders in model User

This turned out to be a fairly simple fix, I had forgotten to add a has_many relationship before adding the has_many :through => x relationship. There is a fairly detailed explanation on StackOverflow for anyone who is curious.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s