Flowdock
method

respond_with

Importance_4
Ruby on Rails latest stable (v6.1.7.7) - 4 notes - Class: ActionController::MimeResponds

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v4.2.1) is shown here.

respond_with(*) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
October 16, 2010 - (>= v3.0.0)
12 thanks

needs to be paired with respond_to

Needs to be paired with respond_to at the top of your class.

class MyController < ApplicationController
  respond_to :js, :html
October 8, 2011
6 thanks

Undocumented :location option

You can use undocumented :location option to override where respond_to sends if resource is valid, e.g. to redirect to products index page instead of a specific product’s page, use:

respond_with(@product, :location => products_url)  
June 24, 2011 - (v3.0.0 - v3.0.9)
1 thank

RailsCast about Responders

See Ryan Bate’s excellent RailsCast #224 about Responders in Rails 3.x: http://asciicasts.com/episodes/224-controllers-in-rails-3

June 1, 2014 - (v4.0.2)
1 thank

Alternitive to to add flash to respond with

This is a nice way to add flash if you don’t have a any logic that needs to go around your flash.

def destroy
  @current_user_session.destroy
  respond_with @current_user_session do |format|
    format.html {redirect_to login_path, notice: "You have been logged out"}
  end
end