Skip to content
This repository was archived by the owner on Aug 6, 2019. It is now read-only.
This repository was archived by the owner on Aug 6, 2019. It is now read-only.

error: find_or_initialize_by_login in Redmine 3.2.2 #17

@dani-sanchez-dorado

Description

@dani-sanchez-dorado

Hello,
I have been using Redmine Rubycas for years in my Redmine 2.3.3 installation without any problem. Now, I'm migrating to Redmine 3.3.2 and I have found another error (I reported another one: #16)

Ticket "ST-10260-ebR9LVc4nTlj0ofY9cKr1jykEdIAjOdVzb6-20" for service "http://my-server.xxx.com/login" belonging to user "XXXX-valid-user-XXXXX" is VALID.
Extra user attributes provided along with ticket "ST-10260-ebR9LVc4nTlj0ofY9cKr1jykEdIAjOdVzb6-20": {}.
Completed 500 Internal Server Error in 33ms (ActiveRecord: 2.0ms)

NoMethodError (undefined method find_or_initialize_by_login' for #<Class:0x0000000556b1c0>): plugins/redmine_rubycas/lib/account_controller_patch.rb:14:in login_with_cas'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

My Redmine configuration is this:

Environment:
Redmine version 3.3.2.stable
Ruby version 2.1.2-p95 (2014-05-08) [x86_64-linux-gnu]
Rails version 4.2.7.1
Environment production
Database adapter Mysql2
SCM:
Subversion 1.8.10
Cvs 1.12.12
Git 2.6.6
Filesystem
Redmine plugins:
clipboard_image_paste 1.8
redmine_checklists 3.1.5
redmine_ckeditor 1.1.4
redmine_edit_custom_fields 0.0.4
redmine_rubycas 0.0.6

The problem is in the call to .find_or_initialize_by_login function

Here is the patch to fix it. In file "plugins/redmine_rubycas/lib/account_controller_patch.rb"

Line 14:

user = User.find_or_initialize_by_login(session[:"#{RedmineRubyCas.setting("username_session_key")}"])

for:

user = User.find_or_initialize_by(login: session[:"#{RedmineRubyCas.setting("username_session_key")}"])

Now it works perfect. I think it would be interesting to add to source code.

Thanks!

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