Ruby in Rails
  • Home
  • Rails
  • Ruby
  • About
GitHub icon LinkedIn icon
Subscribe
akshay

Akshay Mohite

Hi there! I am a Ruby on Rails & ReactJS Enthusiast, building some cool products at DTree Labs.

123 posts •
Rails

Rails skip_before_action callback ignores conditional

Before action callback in Rails has support to add conditions like if and unless. The callback is executed only if the conditions evaluate to true. But, skip_before_action callback does not support conditionals. In

Akshay Mohite Akshay Mohite 2 min read
Rails

Rails parse date time string in UTC zone

Sometimes we need to parse a date string in UTC timezone in Ruby. Time.parse considers system time zone whereas we might want to parse time in UTC or some other custom timzone. This

Akshay Mohite Akshay Mohite 1 min read
Rails

Rails ActiveSupport adds Enumerable#index_with method

Rails ActiveSupport Enumerable adds index_with method. This method allows creating hash with a value from block passed or default value. This is useful when we want to create a hash and value needs

Akshay Mohite Akshay Mohite 2 min read
Rails

Rails set timezone per request

Sometimes we need to have a request be processed in a particular timezone in Rails. To set a timezone per request in Rails, we can have an around filter that sets timezone, runs

Akshay Mohite Akshay Mohite 1 min read
Rails

Rails render 404 not found from a controller action

Rails redirects route not found requests to 404.html page. Sometimes, we need to redirect to 404 not found page from a controller action. This can be done by rendering 404.html page or raising

Akshay Mohite Akshay Mohite 1 min read
Rails

Do not set Time.zone to avoid timezone issues in Rails

Setting Time.zone in a Rails application changes time zone globally. Whenever Time.now is used in any other request, it uses whatever Time.zone is set to earlier. To avoid Time.zone issues, do not set

Akshay Mohite Akshay Mohite 2 min read
« Newer Posts Page 8 of 21 Older Posts »
Ruby in Rails © 2021
Latest Posts Github Twitter LinkedIn

Subscribe to Ruby in Rails

Stay up to date! Get all the latest posts delivered straight to your inbox