Skip to content

NameError: `@' is not allowed as an instance variable name #765

@fguillen

Description

@fguillen

Expected Behavior

No error

Actual Behavior

The application works good until it doesn't any more :/

When I try to access to the website I see this error:

File "/Users/user/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/authlogic-6.4.2/lib/authlogic/session/base.rb" line 1127 in instance_variable_set
File "/Users/user/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/authlogic-6.4.2/lib/authlogic/session/base.rb" line 1127 in initialize
File "/Users/user/Development/MyApp/app/controllers/front/front_sessions_controller.rb" line 5 in new
File "/Users/user/Development/MyApp/app/controllers/front/front_sessions_controller.rb" line 5 in new

I see in the code here:

that password_field may be empty an there for we are executing this:

instance_variable_set("@", nil)

This is my code affected line:

def new
  @front_session = FrontSession.new
end

This is my FrontSession implementation:

class FrontSession < Authlogic::Session::Base
  authenticate_with FrontUser

  def to_key
    new_record? ? nil : [send(self.class.primary_key)]
  end

  def persisted?
    false
  end
end

This is in my FrontUser:

class FrontUser < ApplicationRecord
  acts_as_authentic do |config|
    config.crypto_provider = ::Authlogic::CryptoProviders::SCrypt
    config.session_class = FrontSession
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions