Saturday, 31 August 2013

Where does 'flash' belong to?

Where does 'flash' belong to?

The forth line below sets flash, which is a FlashHash instance.
class LoginsController < ApplicationController
def destroy
session[:current_user_id] = nil
flash[:notice] = "You have successfully logged out."
redirect_to root_url
end
end
Where does this FlashHash instance belong to? If it's a global variable,
it should begin with $, and if it's a member variable of Application
Controller or its superclasses, the name should begin with @, correct? Is
it just a local variable that was created in "destroy" function?

No comments:

Post a Comment