New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails 4.2 : ActionView::Template::Error (undefined method `model_name' for #<UserSession: no credentials provided>) #432
Comments
I thought Rails went to requiring Until a proper fix is released in AuthLogic, you can use this, which seems to have worked for me: class UserSession < Authlogic::Session::Base
include ActiveModel::Naming
def parents
[]
end
def name
"UserSession"
end
end Caveat: I still have a bunch of errors to work through, but this removed the error on the login form for my app. No idea if logging in actually works because other errors are preventing the pages from loading. 😄 |
So I'm not sure if that's all that is needed. Trying to log in now, and it seems like none of my passwords are matching. But I'm updating from an app that started life in Rails 1.x, and its latest version is being updated from 3.2 to 4.2. |
Hi @codeodor, I'll try that ASAP and tell if I have other issues. It's an old app we have been migrating too. From Rails 2.0 to 2.2, then to 3.0, then to 3.2, then to 4. And now to 4.2. |
Yep it does fix the login page and the passwords are matching. I did not test the other features yet, I'll let you know if Authlogic fully works on 4.2 for me. Thanks again ! |
@bwlang I think (mentioned in case you're making that a pull request) |
That fixed the same problem for me on an app that is being upgraded from 3.2 to 4.2 |
I'm running the 4.2 code suggested by codeodor in production now... seems solid. |
@tiegz My tests were giving errors, so I enabled |
@tiegz No it doesn't work with |
@tiegz Thanks for the tip about the password matching. I enabled migration and it worked like a charm! |
This fixed the problem for me: class UserSession < Authlogic::Session::Base
extend ActiveModel::Naming
end |
@orien Of course! Why didn't I think of that? 😁 That's a much better solution. |
With the Rails 4.2 release out, this is starting to hit more and more authlogic-based apps. Is what @orien suggested a safe work-around? (seems to be working well for my app) |
I've just pushed a commit to fix this (and cleanup some old methods)... wfm in a new Rails 4.2 app. If anyone else can confirm, I'll update the gem too: |
@tiegz I can also confirm that the pushed changes [1]appear to work well after removing the extend work-around above from my app. [1] i.e. deploying from git@github.com:binarylogic/authlogic.git |
Ok, thanks everyone! Just pushed the v3.4.4 gem: |
Awesome, thanks! 👍 |
Did a deployment wit the official gem and basic login/logout seems to work fine. Thanks and great job. |
Hello,
I'm migrating my app from Rails 4.1 to 4.2, with AuthLogic version 3.4.2.
When visiting the login page, I get this error in the view :
Here is the associated controller :
And the session model is empty :
And the user model :
Any idea ? Thanks.
The text was updated successfully, but these errors were encountered: