# How could I let rails render wml by default with render/redirect\_to method in the controller

**URL:** <https://www.ruby-forum.com/t/how-could-i-let-rails-render-wml-by-default-with-render-redirect-to-method-in-the-controller/156577>\
**Category:** Rails\
**Created:** [December 30, 2008, 9:12am UTC](https://www.ruby-forum.com/t/how-could-i-let-rails-render-wml-by-default-with-render-redirect-to-method-in-the-controller/156577 "2008-12-30T09:12:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 30, 2008, 9:12am UTC](https://www.ruby-forum.com/t/how-could-i-let-rails-render-wml-by-default-with-render-redirect-to-method-in-the-controller/156577/1 "2008-12-30T09:12:53Z")

</div>

Hi all,

I am using rails to create a wap site. I have using the following code  
in the rails to make it work:

#environment.rb  
Mime::Type.register “text/vnd.wap.wml”, :wml

#controller  
def index  
… # some unrelated code  
respond\_to do |format|  
format.wml # index.wml.erb  
end  
end

and I created the view as index.wml.erb

It works well when I visit the site, but if I using redirect\_to or  
render method in the controller instance method, the browser will tell  
me template missing like show.html.erb, which means rails try to  
render the view by .html.erb rather than the wml.

Is there any way I could let rails always trying to render .wml by  
default?

Thanks
