0

BUTI would like to know why when i comment
require_role 'admin'
in my controller everything works fine but if i UNcomment it i have an error:
NameError in Asset/stationsController#index
uninitialized constant Asset::StationsController

I do understand that it is use to restrict access (to some actions) for the non-admin user.
log
Processing ApplicationController#index (for 127.0.0.1 at 2012-02-29 17:18:21) [GET]
Parameters: {"action"=>"index", "controller"=>"asset/stations"}
NameError (uninitialized constant Asset::StationsController):

its not calling StationsController#index BUT ApplicationController#index

mamesaye
  • 2,033
  • 2
  • 32
  • 49
  • Where is this require_role coming from? A gem? – iltempo Feb 29 '12 at 22:38
  • its a plugin. [link]http://code.google.com/p/rolerequirement/ – mamesaye Feb 29 '12 at 22:44
  • Hard to say without deeper knowledge on you code. I could imagine that a redirect to `/asset/stations` kicks when you enable require_role. Then the default route in your routes.rb is trying to find a controller with that name. Maybe this url is just wrong. – iltempo Feb 29 '12 at 23:16
  • what do you mean by the url is just wrong? – mamesaye Mar 05 '12 at 21:02
  • Is there an url like `asset/stations` in your app? Assets maybe? – iltempo Mar 05 '12 at 21:09
  • yes i have this URL **http://127.0.0.1:3000/asset/stations** and it works only if i disable **require_role 'admin'** in the controller stations. If i enable it i have the the error – mamesaye Mar 05 '12 at 21:51

0 Answers0