G.Hines
G.Hines

Reputation: 63

Having an 'Undefined Method' error in my Ruby on Rails Code

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!

Upvotes: 0

Views: 69

Answers (1)

Paige Ruten
Paige Ruten

Reputation: 176635

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

Upvotes: 3

Related Questions