Topic: My inline RJS works, but my .rjs file doesn't

So I'm confused. I'm doing something pretty simple: submit a form, then display a message with Javascript. First, the form:

<% remote_form_for :question, @question, :url => { :controller => 'question', :action => 'ask' } do |f| %>
    <div id="question_message" style="display: block"></div>
    <div><%= error_messages_for :question %></div>
    <div>Your e-mail <%= f.text_field :asker, :size => 30 %></div>
    <div>Your question <%= f.text_area :text, :rows => 5 %></div>
    <div><%= submit_tag "Ask" %></div>
<% end %>

Next, the controller:
  def ask
    @message = "I did something."
    render :update do |page|
      page[:question_message].replace_html("<p>#{@message}</p>")
    end
  end

This works, but if I try to extract the inline RJS to question/ask.rjs, it doesn't work. Specifically, although I get a response, nothing updates the div#question_message.

This appears not to be a browser issue, since the behavior (all of it) is the same on IE 7, Firefox and Safari.

Any ideas? I have none.

Re: My inline RJS works, but my .rjs file doesn't

Do you have an "ask.rhtml" file as well? If so, this is probably what is being called.

Railscasts - Free Ruby on Rails Screencasts

Re: My inline RJS works, but my .rjs file doesn't

I have an _ask.rhtml partial, but not an ask.rhtml template, so could that be a bug in Rails? I'll try renaming that file and I'll report if that's the case. If so, I think that's a bug. Rails should be able to tell the difference betweeen ask.rhtml (which I understand would gum up the works) and _ask.rhtml (which I don't think should).

Thank you.

Re: My inline RJS works, but my .rjs file doesn't

Evidently it's something subtler, because although my app now works, when I tried to write a smaller test case to submit to Rails, that worked too. Hm. I'll have to tuck this in my back pocket until it comes up again, I guess.

Thanks again.