link_to_remote still looks for view.html.erb?

I know I'm missing something. Invariably, whenever I try to add some kind of RJS action to a page it never "just works".

I'm working on a page that will be the user's primary interface with the site. If I can, I'll make it the only interface. I'd like all the other forms to come up as "dialogs" on top of the normal page. I'm working on the first of those now. I've got a link_to_remote tag, going off to a resource's controller and the "new" action. I've got the new.rjs.erb file in the correct views sub-directory. But when I click on the generated tag, I get a MissingTemplate exception because there is no new.html.erb file. I can't see anything in the url_for, link_to, or link_to_remote options that will let me explicitly set the content type of the request. Basically, I want the response to always be an rjs template. How do I make this work?

Thanks for your help!


The naming standard is now <action>.<format>.<renderer> so try naming
your file 'new.js.rjs'. This will help rails figure out how to return
'js' using the 'rjs' rendering.

You may also need to add the respond_to block so that the framework
understands that you want to deal with more than just the default html

  def new
    @joke =
    respond_to do |wants|
      wants.html # new.html.erb
      wants.js # new.js.rjs


Awesome, thank you that worked!