0

I am currently in the middle of a project where we have to use Ruby on Rails which I haven't used before. I am trying to add a login system and found a guide using AuthLogic (https://gist.github.com/ahmadhasankhan/858801cda04a56ee0c17) and everything was working as I expected until the 12th step. I try to add:

acts_as_authentic do |c|
c.login_field = :email
end

to my user.rb file.

However, when I try to update the page I get 'undefined method `acts_as_authentic' for main:Object'.

Being a complete newby and unable to find any help to fix this specific issue thought I'd ask.

Thanks in advance for any help!

2
  • Have you run the bundle command to install the third party code that acts_as_authentic probably comes from? Commented Apr 29, 2018 at 21:43
  • I have yes, I ran it again there to double check but still have the same error. I followed the guide exactly as it is which is why I'm having difficulty finding the issue. Commented Apr 29, 2018 at 21:49

1 Answer 1

3

Make sure the code goes inside the User class, like this:

class User < ActiveRecord::Base
  acts_as_authentic do |c|
    c.login_field = :email
  end
end
Sign up to request clarification or add additional context in comments.

1 Comment

Well I thought I had tried that but mustn't have saved it properly haha, such an obvious mistake too. Thank you so much, really appreciate it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.