I have the following code right after my controller class declaration
before_filter :load_form, :except => [:create, :update, :delete]
after_filter :load_form, :only => [:create, :update, :delete]
def load_form
@severities = Severity.all
@severity = Severity.new
end
I get the list of severities when the page loads just fine, meaning that the before_filter is working. However after calling a method such as create the list of severities always comes back as nil. I think I am probably just missing some fundamental thing about filters. Can anyone help me understand why the after_filter does not work?
If you were expecting to see variables in your view that were assigned in your 'after' filter, that won't work because the filter is not executed until after your view has been completely processed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With