travis michel
2006-Apr-11 05:05 UTC
[Rails] a user model in all controllers in 6 lines of code
Well it took a bit of research, and making a fool out of myself; but I found a way to get a user model from the session and have it accessible in every controller and view in 6 lines of code. In the ApplicationController write model :user before_filter :set_user private def set_user @user = session[:user] ||= User.find_by_username(''nobody'') end I have redeemed myself (whoohoo!!)