Question for method_missing

Marcelo,

I'm trying to figure out why you'd want to use method_missing to load an object from the session...

If you're already typing:

obj = session_object_Usuario

Then it seems easier, faster, and more secure to define an accessor:

# application.rb

def current_usuario   @current_usuario ||= (session[:usuario_id] ? Usuario.find(session[:usuario_id]) : nil) end helper_method :current_usuario

Hope this helps.