views:

29

answers:

1

What I'm trying to do is pretty simple: generate a list of permissions based on controllers action defined roles.

This works pretty nicely, the only problem, is that when I try to generate the list of rails controllers a second time (note: the first time works flawlessly) using:

ActionController::Routing.possible_controllers

I get an array of current controller classes instead of strings, like I would get the first time, needless to say, this breaks my code by generating an exception.

Why does this method act differently on multiple calls ? Is it something I'm missing, or a ruby/rails bug ? (I'm running on windows)

The temporary fix: I store the resulted string array in the session so the next time I retrieve the list from there without calling again the possible_controllers method.

But when a user logs off and a new one logs in the problem reappears, which will not work for production, meaning I would need to take it off.

A: 

The docs say it should return an array. So i suggest you write your code to work with the array version and then insert a dummy call to get rid of the string version, you might also have found a bug, if you have please report it.

thomasfedb