How to make code accessible in controller, view and possibly model

I am currently trying to implement the access control part of my
project ( a bugzilla type project).

My problem is the following. I have a set of basic functions to
determine if a user has access to a bug (and what type of access). I
would like these functions to be available all through my application
(controller, views and hopefully model) but I can't seem to find how.

For the time being I duplicate the code in ApplicationController and
ApplicationHelper to have the functions available in controllers and
views, but this solution is obviously horrible. And it doesn't even
allow me to access the functions in the model.

Any help would be appreciated,


Throughout the application, put them in a seperate class and put that class in RAILS_ROOT/lib. Rails reloads everything in lib/ on server restart, and you’ll have access to that class everywhere in your app.


Thank you very much. It worked like a charm.