I have a relationship model that tracks customers (users) of shops in a has_many :through
association. I\'m having trouble with my ShopsController
Your relationships
method in your controller is all over the place.
You're trying to find relationshipS using a find by id with a non-existent params[:relationship_id]
which is causing the error you're seeing.
You're then setting @users
to be all the relationships for the @shop
.
Then you're rendering a template show_relationships
but you refer later to a relationships/show
template.
Additionally in the shop model you're calling create
on relationships with just a user id whereas you'd expect to be passing in some attributes for the relationship.
It looks like this code has got messier and messier as you've tried to solve the problem. To be perfectly honest I'd go back to the beginning and start again.