Skip to content

Instantly share code, notes, and snippets.

@dkumar431
Created October 19, 2016 04:25
Show Gist options
  • Save dkumar431/7d99b2c0699f8bd820861deba6bc0825 to your computer and use it in GitHub Desktop.
Save dkumar431/7d99b2c0699f8bd820861deba6bc0825 to your computer and use it in GitHub Desktop.
class StudentController < ApplicationController
respond_to :html, :xml, :json
def index
begin
@students = Student.all
# respond_to do |format|
# format.html { Rails.logger.warn { "html executed." } }
# format.js {render "show_person_details"}
# format.xml { render :xml => @students.to_xml }
# format.json { render json: @students}
# end
respond_with(@students)
rescue => e
Rails.logger.warn { "ajay sahu warn: " }
Rails.logger.error { "deepak kumar error: #{e.class} #{e.message} #{e.backtrace}" }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment