# Multiview: Format fallback from fbml to html (register\_alias/request.format)

**URL:** <https://www.ruby-forum.com/t/multiview-format-fallback-from-fbml-to-html-register-alias-request-format/142637>\
**Category:** Rails\
**Created:** [July 9, 2008, 11:47pm UTC](https://www.ruby-forum.com/t/multiview-format-fallback-from-fbml-to-html-register-alias-request-format/142637 "2008-07-09T23:47:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Canavese](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/eb9ed0/32.png) [@Paul\_Canavese](https://www.ruby-forum.com/u/Paul_Canavese)\
**Post date:** [July 9, 2008, 11:47pm UTC](https://www.ruby-forum.com/t/multiview-format-fallback-from-fbml-to-html-register-alias-request-format/142637/1 "2008-07-09T23:47:56Z")

</div>

I’m using Rails 2.1 with the Multiview template mechanism to create a  
hybrid Facebook and public site. For the most part, there are  
analogous views across the two. Since Facebook supports a subset of  
HTML, some of my HTML views and partials could be shared across the  
two.

I have registered a Mime type alias for FBML in my mime\_types.rb:  
Mime::Type.register\_alias(“text/html”, :fbml)  
and have a filter in my controller to set it appropriately:  
request.format = :fbml  
That all seems fine.

I would like to use an FBML template (e.g. “foo.fbml.erb”) if it  
exists, but otherwise fall back to an HTML template (e.g.  
“foo.html.erb”). I have seen references that it should work like this  
already (e.g.  
[Locomotivation.com is for sale | HugeDomains](http://locomotivation.com/2008/06/28/redesign-your-site-in-place-using-rails-custom-mime-types)),  
but I get “Template is missing” errors if the FBML template is not  
there.

It seems to work to name common templates without a format (e.g.  
“foo.erb”), which I am doing now, but is there a way to get it to  
default back to HTML first?

Regards,

Paul
