Skip to content

Instantly share code, notes, and snippets.

@paneq
Created May 23, 2012 11:46
Show Gist options
  • Save paneq/2774761 to your computer and use it in GitHub Desktop.
Save paneq/2774761 to your computer and use it in GitHub Desktop.
Alternative respond formats
respond_to(:json, :html) do |json, html|
json { render :json => UserSessionPresenter.new(current_user) }
html { redirect_back_or_default root_path }
end
format do |json, html|
json { render :json => UserSessionPresenter.new(current_user) }
html { redirect_back_or_default root_path }
end
format do
json { render :json => UserSessionPresenter.new(current_user) }
html { redirect_back_or_default root_path }
end
json { render :json => UserSessionPresenter.new(current_user) }
html { redirect_back_or_default root_path }
respond_to do |format|
format.json { render :json => UserSessionPresenter.new(current_user) }
format.html { redirect_back_or_default root_path }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment