I am trying setup Authlogic gem with rails 7. I have simple controller:
class UsersController < ApplicationController
def new
render_page 'Registration'
end
def create
@user = User.new(email: 'codcore@gmail.com', password: 415561)
if @user.save
redirect_to root_url
else
render_page 'Registration', props: { errors: @user.errors_codes }
end
end
private
def user_params
params.require(:user).permit(:name, :surname, :email, :password, :password_confirmation).to_h
end
end
and simple User
model:
class User < ApplicationRecord
self.inheritance_column = 'there_is_no_sti_here'
acts_as_authentic do |c|
c.session_class = Session
c.crypto_provider = ::Authlogic::CryptoProviders::BCrypt
end
end
But when I call create
action of UsersController
, I get error:
NameError - wrong constant name
Object.const_get(camel_cased_word)
^^^^^^^^^^:
app/controllers/users_controller.rb:8:in `create'
That error refers to @user.save
in UsersController
. I can not figure out what is happenning. I tried to debug this line, but did not understand what is going on. Also I tried authlogic
gem right from the GitHub repository, but it didn't help.
The most interesing part that all works as intended when I create new instnce of User
and then save it from rails console
...