# UserEngine infinite loop... only on production box

**URL:** <https://www.ruby-forum.com/t/userengine-infinite-loop-only-on-production-box/55053>\
**Category:** Engines\
**Created:** [March 16, 2006, 6:05pm UTC](https://www.ruby-forum.com/t/userengine-infinite-loop-only-on-production-box/55053 "2006-03-16T18:05:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hatless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/848f3c/32.png) [@hatless](https://www.ruby-forum.com/u/hatless)\
**Post date:** [March 16, 2006, 6:05pm UTC](https://www.ruby-forum.com/t/userengine-infinite-loop-only-on-production-box/55053/1 "2006-03-16T18:05:50Z")

</div>

Since the Engines seem to be more actively maintained than the generator  
I’d been using, I switched over and got everything working on my  
development system. When I ran into a problem with changing passwords, I  
checked this list and found the thread about applying the before\_filter  
as a mixin to my user\_controller because I don’t apply a filter to my  
public controller, and I did the same for the roles controller and  
everything seemed to work perfectly.

Then I used Switchtower to transfer my latest build to my production  
box. I migrated both engines, did a successful bootstrap, checked to  
nsee that the tables were all properly populated, checked to see the  
admin user was created with a good email address, and restarted Apache.  
My unprotected controllers worked perfectly fine, so it’s not a problem  
with the app running.

But the protected controllers? No dice. I delete my sessions in /tmp. I  
do an explicit /user/logout. Whatever I do on protected controllers, I  
get an endless loop of /user/login, using the “admin/testing” login/pw.

Clicking “forgot password” gets me the same error as the post re:  
login\_engine of a couple of weeks ago: the error related to the nil user  
when trying to display the flash.

Again, on my dev box in dev environment I have no problems. When not  
logged in, attempting to access a protected controller propmpts for  
login, login works, and life proceeds as normal. Logging out, confirming  
I’m logged out by trying to access a protected controller, and then  
clicking the change\_password link works like it’s supposed to, from the  
email to the token-based login to the new-password page.

And unlike some recent posters, I’m not doing crazy things with routes.  
Nothing interferes with the /user/ URI namespace.

I have no idea why this is working in dev but not production.

Here’s what I’ve got at the top of each of my protected controllers, as  
well as in otherwise empty mixin user and role controllers:

before\_filter :authorize\_action

I do not have this in application.rb because I have a controller that at  
present doesn’t require login.

Thanks.

---

<div class="post-metadata">

**Author:** ![hatless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/848f3c/32.png) [@hatless](https://www.ruby-forum.com/u/hatless)\
**Post date:** [March 16, 2006, 6:55pm UTC](https://www.ruby-forum.com/t/userengine-infinite-loop-only-on-production-box/55053/2 "2006-03-16T18:55:52Z")

</div>

By the way, my best theory on why this is happening on one box but not  
the other is that the dev box went through intermediate steps like  
running with login\_engine successfully before adding user\_engine and  
making the prescribed changes. On the dev system because I’d been  
running login\_engine for a couple of days already so when I brought  
things up to user\_engine I had several working users already and my  
initial user setup didn’t have to rely on user\_engine’s  
authorize\_action.

Steve K. wrote:

> Since the Engines seem to be more actively maintained than the generator  
> I’d been using, I switched over and got everything working on my  
> development system. When I ran into a problem with changing passwords, I  
> checked this list and found the thread about applying the before\_filter  
> as a mixin to my user\_controller because I don’t apply a filter to my  
> public controller, and I did the same for the roles controller and  
> everything seemed to work perfectly.
> 
> Then I used Switchtower to transfer my latest build to my production  
> box. I migrated both engines, did a successful bootstrap, checked to  
> nsee that the tables were all properly populated, checked to see the  
> admin user was created with a good email address, and restarted Apache.  
> My unprotected controllers worked perfectly fine, so it’s not a problem  
> with the app running.
> 
> But the protected controllers? No dice. I delete my sessions in /tmp. I  
> do an explicit /user/logout. Whatever I do on protected controllers, I  
> get an endless loop of /user/login, using the “admin/testing” login/pw.
> 
> Clicking “forgot password” gets me the same error as the post re:  
> login\_engine of a couple of weeks ago: the error related to the nil user  
> when trying to display the flash.
> 
> Again, on my dev box in dev environment I have no problems. When not  
> logged in, attempting to access a protected controller propmpts for  
> login, login works, and life proceeds as normal. Logging out, confirming  
> I’m logged out by trying to access a protected controller, and then  
> clicking the change\_password link works like it’s supposed to, from the  
> email to the token-based login to the new-password page.
> 
> And unlike some recent posters, I’m not doing crazy things with routes.  
> Nothing interferes with the /user/ URI namespace.
> 
> I have no idea why this is working in dev but not production.
> 
> Here’s what I’ve got at the top of each of my protected controllers, as  
> well as in otherwise empty mixin user and role controllers:
> 
> before\_filter :authorize\_action
> 
> I do not have this in application.rb because I have a controller that at  
> present doesn’t require login.
> 
> Thanks.
