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 -

html - Accumulated Depreciation of Assets on php -

node.js - Node - Passport Auth - Authed Post Route hangs on form submission -