Rails 8 Beta Bug: Fixing authenticated? Helper with allow_unauthenticated_access

Posted on

In Rails 8 Beta 1, I ran into a bug with the new built-in authentication package. The authenticated? helper method would return false on routes using the allow_unauthenticated_access method to bypass authentication. My use case was to show an edit button only if I was authenticated. There are plenty of scenarios where you'd want this functionality.

Thankfully, this issue has already been addressed and merged ("Fix helper behavior on controller that don't require authentication #53175"). It will be resolved in the next release, but if you want to fix it now, check the issue linked above for the details.

Permalink