Do you have a File model? If so then provide either instance or class
methods to do the file type testing rather than having code for them
in the view. If you don't have a File model then create one (not
ActiveRecord based) to manage the logic.
Colin