【rubycas-server】遇到的一些问题记录

1.启动时遇到can't load sucn file activerecord-mysql2-adapter

明明都已经装好了,但是就是报这个错误。

后来调查发现,rubycas-server-1.1.2使用activerecord-3.0.20。

 而这个版本的activerecord总是试图从自己的目录里读取mysql2_adapter.rb文件,但是他自己又没有。

好像3.2.21版本的activerecord里就包含有该文件了。

于是单独安装activerecord-mysql2-adapter的gem,并把其中的"mysql2_adapter.rb"的文件拷贝到activerecord-3.0.20相应的目录下,就解决了。



2.尝试登陆验证时报错:

ActiveRecord::SubclassNotFound - The single-table inherita
nce mechanism failed to locate the subclass: 'User'. This error is raised becaus
e the column 'type' is reserved for storing the class in case of inheritance. Pl
ease rename this column if you didn't intend it to be used for storing the inher
itance class or overwrite CASServer::Authenticators::SQLEncrypted::CASUser_0.inh
eritance_column to use another column for that information.


user表里有一个type字段,这个字段名字是保留字所以就报错了。

解决方法:

配置文件中加上一个ignore_type_column: true

authenticator:
  class: CASServer::Authenticators::SQLEncrypted
  database:
    adapter: mysql2
    database: bitnami_redmine
    username: bitnami
    password: b600d8e46e
    port: 3308
    host: localhost
  user_table: users
  username_column: login
  encrypt_function: 'user.hashed_password == Digest::SHA1.hexdigest("#{user.salt}#{Digest::SHA1.hexdigest(@password)}")'
  ignore_type_column: true

猜你喜欢

转载自blog.csdn.net/lokira518/article/details/48948281