A passionate full stack software engineer having 7 years of experience in building scalable enterprise systems. I have worked predominantly with the JVM and Javascript ecosystem but currently exploring Rails. For me, software engineering is all about solving problems in the most optimal way. I am an avid practitioner of clean code practices and love to read about System Design and Architectures. When I am not coding I love to play playstation, read anything about aviation or go out for a long drive and of-course I am foodie by heart.
1 minute read
Now that Ruby 2.7 has added the support for
beginless range,
Rails 7 also adds support to include the beginless range in
ActiveRecord inclusivity/exclusivity validators.
Prior to Rails 7, if we were to add a validation to a Product model
where the price needs to be within 5000,
we’d have to follow this method-
Before
Also, if we would try adding beginless range,
then it will throw an error.
As it can be seen,
it throws an error saying cannot get the first element of beginless range.
After
After Rails 7,
we can now add the beginless range.