1 minute read
Now that Ruby 2.7 has added the support for
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-
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 Rails 7,
we can now add the beginless range.