Deepak Jadhav

Rails before? after? methods to compare date / time

Before Rails 6.0, the date/time are compared by using the equality operators like less than (<) or greater than (>), etc. Sometimes, date/time comparison using these operators takes some time to understand as these conventions are not human-readable at least for dates. Now, Rails 6.0 active support introduced with two new methods before? & after? …

Rails before? after? methods to compare date / time Read More »

Rails IP-Based access restriction with route constraints

Sometimes we need to limit access based on IP address and whitelist only certain IP addresses to access a route. We can use rails routing constraints to restrict an access. We can either whitelist or blacklist IP addresses for a route. Rails provides different basic constraints on routes like: HTTP Verb Constraints Segment Constraints Request-Based …

Rails IP-Based access restriction with route constraints Read More »