render :nothing deprecated?

I get a warning "render :nothing deprecated, use render :file instead"... but I cannot find any info on how to use render :file to render nothing. It's also not mentioned on the deprecated items web page, it this warning a bug?

render :nothing => true should still work and not be deprecated.

Ferd

To add to what Fred said, you may be wondering why you need

   :nothing => true

instead of just

   :nothing

The reason is that you used to be able to write:

   render "path/to/some_file.rhtml"

which was equivalent to

   render_file "path/to/some_file.rhtml"

The Rails guys decided to get rid of all the render_xxx methods and just have a single render method that takes a hash of options:

   render :action => 'blah'    render :file => 'blech'    render :inline => '<%= foo %>'

In order to provide backward compatibility, render looks at its argument. If it's a Hash, it's treated as the new-style way of doing things. Otherwise, it's assume to be the old render "some_file" method, so the argument gets passed along to render_file, and a deprecation warning is issued (since this will go away completely in Rails 2.0).

So, with all that background,

   render :nothing

actually is transformed into

   render :file => :nothing

which isn't what you intended.

By writing

   render :nothing => true

render receives a Hash as it's argument (because of the => operator), so you get nothing rendered.

Ruby has an interesting feature in method calls, where a Hash literal and the *end* of a parameter list does not need to be enclosed in braces. So

  render :nothing => true

is really the same as

  render({:nothing => true})

It's a nice feature, because it cuts down on the "line noise" so common with Perl e.g., but you need to be aware of it because it can be misleading. For example:

   update_attribute :foo, "Bar" # two arguments passed    update_attributes :foo => "Bar" # *one* argument (a Hash) passed

Ah, thanks for the reply both. I noticed it's my own fault (as usual), I used a string instead of a symbol but the warning message threw me off:

DEPRECATION WARNING: You called render('nothing'), which is a deprecated API call. Instead you use render :file => nothing.