I just finished writing the code for Week 2 and I am getting an error when I try to follow another user that reads,
Unable to autoload constant FollowingRelationship, expected ../following_relationship.rb to define it
I’m using Rails 4 and Ruby 2.0.0-p247, I think that might be the problem. But here is a screenshot:
Any ideas? Thanks!
It is expecting that you have a
FollowingRelationship class defined in
following_relationship.rb but not finding it. Does that class exist there? If so, maybe you have a typo in the file name?
Here’s my User model and FollowingRelationship model:
class User < ActiveRecord::Base
has_many :followed_users, through: :followed_user_relationships
has_many :followers, through: :follower_relationships
class FollowingRelationShip < ActiveRecord::Base
belongs_to :follower, class_name: 'User'
belongs_to :followed_user, class_name: 'User'
You capitalized the ‘S’ in relationship. The class is named
FollowingRelationShip but your
has_many line says that it should be named
Sheesh. Thanks very much. I scoured that for an hour.