title: Rails: respond_to JSON and HTML
body: <p>I have a controller "UserController" that should respond to normal and ajax requests to <code>http://localhost:3000/user/3</code>.</p>
  
  <p>When it is a normal request, I want to render my view. When it is an AJAX request, I want to return JSON.</p>
  
  <p>The correct approach seems to be a <code>respond_to do |format|</code> block. Writing the JSON is easy, but how can I get it to respond to the HTML and simply render the view as usual? </p>
  
  <pre><code>  def show
      @user = User.find(params[:id])
      respond_to do |format|
        format.html {
          render :show ????this seems unnecessary. Can it be eliminated??? 
        }
        format.json { 
          render json: @user
        }
      end
    end
  </code></pre>