ruby on rails - How to "inherit" a class variable from ApplicationController -


i'm little new rails.

say want like:

def is_admin?  @admin = user.grab(session[:username]).admin end 

i can define in applicationcontroller have call is_admin?() in every method in every subsequent controller. there way around not aware of?

use :before_filter @ start of each controller:

before_filter :is_admin 

at least don't have every method.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -