Member-only story

Ruby and Ruby on Rails Productivity Tricks - part 1

Gokul
3 min readMar 26, 2021

--

Sometimes software developers believe that productivity means writing code as quickly as possible. However, true productivity with a programming language is determined by the quality of your code.

I’ll be sharing a few tips here to help you stay productive as a developer. When I say to improve your productivity, I don’t mean learning a faster way to code, a faster way to replace, or a faster way to deploy Ruby/Ruby on rails web applications.

I’m referring to the ones that we can all ensure are going to happen!!!

HTTP status codes

While receiving/processing the API response we have definitely seen the status code part of it. Are you not aware of what is the exact meaning of the specific status code?

Don’t worry Ruby/Ruby on rails helps to get it!!! Here is the way,

  • First, should open the IRB console in terminal
  • Require the “status” package
require 'net/http/status'
  • Execute the following line
Net::HTTP::STATUS_CODES.each do |code, meaning|
puts "#{code} ==> #{meaning}\n"
end
  • Will get the HTTP error codes and meaning as like below,
100 ==> Continue

101 ==> Switching Protocols

102 ==> Processing

200 ==> OK
201 ==> Created 202 ==> Accepted

--

--

Gokul
Gokul

No responses yet