By Avishek Jana
RScratch is a Ruby on Rails gem that helps you to manage bugs in your application. Think RScratch as a self-hosted bug tracker alternative you can easily integrate into your site.
- Completely designed for Ruby on Rails.
- Self-hosted.
- Easy integration.
- Data representation in both grathical and tabular format.
- UI is developed on top of Material Design.
- Exception log comes with full backtrace, parameters, client details and request preconditions.
Add this line to your application's Gemfile:
gem'rscratch'And then execute:
$ bundleinstallAfter you install RScratch, you need to run the generator:
$ railsgrscratch:installThe generator will create few migration files, a initializer file, and routes to access Rscratch WebUI. It is imperative that you take a look at it. When you are done, you are ready to run migration using the following command:
$ rakedb:migrateYou should restart your application after installing RScratch gem.
Add this following line in rescue block of your your code. An example is given below
Rscratch.log_exceptione,requestAn example is given below
defcreatebegin@post=Post.new(params[:post])@post.saverespond_todo |format|
format.json{renderjson: @post,status: :created,location: @post}endrescueException=>e# Log exception in RScratchRscratch.log_exceptione,requestrespond_todo |format|
format.json{renderjson: @post.errors,status: :unprocessable_entity}endendendNow everything looks sparky. Rscratch comes bundled with a web UI to track exceptions raised from your application. Go to the following URL to access it.
http://{YOUR_APP_URL}/rscratch/
Ohh!! you may be asked for username and password once you visit this page. Default credentials are given below.
username: adminpassword: admin123To change this credentials check rsctarch initializer file.
#config/initializers/rscratch.rbRscratch.configuredo |config|
config.authenticate=Proc.newdoauthenticate_or_request_with_http_basicdo |username,password|
username == "admin" && password == "admin123"endendendBug reports and pull requests are welcome on GitHub at https://github.com/avishekjana/rscratch. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.


