I can't seem to get a flash message to display in my app after catching an exception.
I have a method that loads the current user based on the current subdomain, the current_subdomain_user method throws an ActiveRecord::RecordNotFound if it can't find a user for a particular subdomain.
I have a before_filter that calls this method and catches any record not found exceptions, sets a flash message and redirects.
The problem is that the flash message isn't being displayed, I can't understand why not. Any help would be much appreciated. Below is the before filter
def user_required begin current_subdomain_user # this method will raise an exception if the current subdomain user can't be found rescue ActiveRecord::RecordNotFound flash[:error] = "Couldn't find the user #{current_subdomain}" redirect_to root_url(:subdomain => false) end end