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!
Mark
The page with the link:
…
The controller:
class JokesController < ApplicationController
def new
@joke = Joke.new
end
end
The new.rjs.erb file:
page.insert_html :bottom, ‘content’, :partial => “newJoke”, :object =>
@joke
The _newJoke.html.erb file: