Deprecate `:nothing` option for render method #20336

Merged
merged 1 commit into from May 28, 2015

Conversation

Projects
None yet
5 participants
@meinac
Contributor

meinac commented May 28, 2015

head method works similar to render method with :nothing option
Please see #20320 for more information.
/cc @rafaelfranca , @carlosantoniodasilva , @kaspth , @claudiob

Deprecate `:nothing` option for render method
`head` method works similar to `render` method with `:nothing` option

spastorino added a commit that referenced this pull request May 28, 2015

Merge pull request #20336 from vngrs/deprecate_nothing_option_for_ren…
…der_method

Deprecate `:nothing` option for render method

@spastorino spastorino merged commit 172e452 into rails:master May 28, 2015

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@claudiob

This comment has been minimized.

Show comment
Hide comment
@claudiob

claudiob May 28, 2015

Member

Wow that was so fast ⚡️ – good job @meinac

Member

claudiob commented May 28, 2015

Wow that was so fast ⚡️ – good job @meinac

@claudiob

This comment has been minimized.

Show comment
Hide comment
@claudiob

claudiob May 28, 2015

Member

Do we also need to upgrade the guides on how to upgrade to Rails 5?

Member

claudiob commented May 28, 2015

Do we also need to upgrade the guides on how to upgrade to Rails 5?

@meinac meinac deleted the vngrs:deprecate_nothing_option_for_render_method branch Mar 16, 2016

dzaporozhets pushed a commit to gitlabhq/gitlabhq that referenced this pull request May 18, 2016

Change deprecated usage of rendering without response body
`render nothing: true` has been deprecated.
For more information see [pr](rails/rails#20336)

@himdel himdel referenced this pull request in ManageIQ/manageiq Jul 13, 2016

Merged

Replace new render :nothing with head :ok #9799

@@ -103,32 +103,6 @@ In most cases, the `ActionController::Base#render` method does the heavy lifting
TIP: If you want to see the exact results of a call to `render` without needing to inspect it in a browser, you can call `render_to_string`. This method takes exactly the same options as `render`, but it returns a string instead of sending a response back to the browser.
-#### Rendering Nothing

This comment has been minimized.

@Erowlin

Erowlin Apr 26, 2017

Why did we removed completely this section from the guide?

Should we replace it with the new head :ok syntax, or body: nil ?
(BTW which one should we use? Since this section has been removed from the guide, we don't know which one to use.)

@Erowlin

Erowlin Apr 26, 2017

Why did we removed completely this section from the guide?

Should we replace it with the new head :ok syntax, or body: nil ?
(BTW which one should we use? Since this section has been removed from the guide, we don't know which one to use.)

This comment has been minimized.

@Erowlin

Erowlin Apr 26, 2017

-> I know it's been merged, should I write the comment on master directly?

@Erowlin

Erowlin Apr 26, 2017

-> I know it's been merged, should I write the comment on master directly?

This comment has been minimized.

@rafaelfranca

rafaelfranca Apr 26, 2017

Member

"TIP: You should probably be using the head method, discussed later in this guide, instead of render :nothing. This provides additional flexibility and makes it explicit that you're only generating HTTP headers."

The documentation about head is already in this same guide. This is why this section was removed since the documentation about head is already there.

@rafaelfranca

rafaelfranca Apr 26, 2017

Member

"TIP: You should probably be using the head method, discussed later in this guide, instead of render :nothing. This provides additional flexibility and makes it explicit that you're only generating HTTP headers."

The documentation about head is already in this same guide. This is why this section was removed since the documentation about head is already there.

This comment has been minimized.

@Erowlin

Erowlin Apr 26, 2017

I can't find any of this on the actual documentation. http://guides.rubyonrails.org/layouts_and_rendering.html

@Erowlin

Erowlin Apr 26, 2017

I can't find any of this on the actual documentation. http://guides.rubyonrails.org/layouts_and_rendering.html

sebjacobs added a commit to Futurelearn/vanity that referenced this pull request Aug 18, 2017

Rails 5.1 compatibility fix
In Rails 5 the `render` method deprecated a number of options including
the `nothing` option [1] (this option was removed entirely in Rails
5.1).

Previously vanity relied on this method for implementing its
`add_participant` controller endpoint.

Rather than using `render nothing: true`, we can use the `head` method
if we do not require a body in the response.

**Notes**

From what I can tell the `head` method is available in all of the
versions of Rails supported by the `vanity` gem and so we maybe able to
get this fix merged in upstream.

[1] rails/rails#20336

sebjacobs added a commit to Futurelearn/vanity that referenced this pull request Sep 18, 2017

Fix `add_participant` on Rails 5.1
In Rails 5 the `render` method deprecated a number of options including
the `nothing` option [1] (this option was removed entirely in Rails
5.1).

Previously vanity relied on this method for implementing its
`add_participant` controller endpoint.

Rather than using `render nothing: true`, we can use the `head` method
if we do not require a body in the response.

**Notes**

It looks like the `head` method is available in all versions of Rails
supported by Vanity (including Rails 3.2).

[1] rails/rails#20336

@sebjacobs sebjacobs referenced this pull request in assaf/vanity Sep 18, 2017

Merged

Fix `add_participant` on Rails 5.1 #330

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment