Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `relation_delegate_class' for Follow:Module #94

Open
marcguilera opened this issue Apr 1, 2017 · 1 comment

Comments

@marcguilera
Copy link

marcguilera commented Apr 1, 2017

I'm trying to follow a user from a user. My User model has acts_as_followable and acts_as_follower. I'm on rails 5 so I have master on my Gemfile:

gem 'acts_as_follower', github: 'tcocca/acts_as_follower', branch: 'master'

I get this error when trying to follow a user:

2.3.0 :002 > User.first.follow User.second
User Load (0.6ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1 [["LIMIT", 1]]
User Load (0.4ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1 OFFSET $2 [["LIMIT", 1], ["OFFSET", 1]]
DEPRECATION WARNING: Setting custom parent classes is deprecated and will be removed in future versions. (called from parent_class_name at /usr/local/rvm/gems/ruby-2.3.0/bundler/gems/acts_as_follower-c5ac7b9601c4/lib/acts_as_follower/follower_lib.rb:10)
NoMethodError: undefined method relation_delegate_class' for Follow:Module from /usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-5.0.2/lib/active_record/relation/delegation.rb:107:in relation_class_for'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-5.0.2/lib/active_record/relation/delegation.rb:101:in create' from /usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-5.0.2/lib/active_record/associations/collection_association.rb:47:in reader'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-5.0.2/lib/active_record/associations/builder/association.rb:111:in follows' from /usr/local/rvm/gems/ruby-2.3.0/bundler/gems/acts_as_follower-c5ac7b9601c4/lib/acts_as_follower/follower.rb:33:in follow'
from (irb):2
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-5.0.2/lib/rails/commands/console.rb:65:in start' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-5.0.2/lib/rails/commands/console_helper.rb:9:in start'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:78:in console' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in run_command!'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in <top (required)>' from /usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in require'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in block in require' from /usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in load_dependency'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in require' from /home/ubuntu/workspace/drezr/drezr-api/bin/rails:9:in <top (required)>'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in load' from /usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in block in load'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in load_dependency' from /usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in load'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.1/lib/spring/commands/rails.rb:6:in call' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.1/lib/spring/command_wrapper.rb:38:in call'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.1/lib/spring/application.rb:191:in block in serve' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.1/lib/spring/application.rb:161:in fork'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.1/lib/spring/application.rb:161:in serve' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.1/lib/spring/application.rb:131:in block in run'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.1/lib/spring/application.rb:125:in loop' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.1/lib/spring/application.rb:125:in run'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in <top (required)>' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from -e:1:in

'2.3.0 :003 >

@kylesnowschwartz
Copy link

Old post, but I recently had an issue where an empty directory with the same name as my model was causing this error to be raised. Try running the following code:
git clean -x -n -f -d | grep follow which should show you if you have an untracked directory named 'follow'. If so, and it's not supposed to be there, try removing that directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants