Rails 7: ComparisonValidator

Everyone who has worked or is working in the Rails ecosystem will recognise the piece of code in the code snippet.

I am talking about the custom validator method #end_date_is_after_start_date. Before Rails7, there was no inbuilt validator present for such a use-case.

Rails 7 added π‚π¨π¦π©πšπ«π’π¬π’π¨π§π•πšπ₯𝐒𝐝𝐚𝐭𝐨𝐫, and it provides a lot of comparison options like πšπš›πšŽπšŠπšπšŽπš›_πšπš‘πšŠπš—, πšπš›πšŽπšŠπšπšŽπš›_πšπš‘πšŠπš—_πš˜πš›_πšŽπššπšžπšŠπš•_𝚝𝚘, πšŽπššπšžπšŠπš•_𝚝𝚘, πš•πšŽπšœπšœ_πšπš‘πšŠπš—, πš•πšŽπšœπšœ_πšπš‘πšŠπš—_πš˜πš›_πšŽπššπšžπšŠπš•_𝚝𝚘 and πš˜πšπš‘πšŽπš›_πšπš‘πšŠπš—.

Check out this insightful article from Vishal Jain to learn more about this, And let me know if you think this is a valuable addition to ActiveRecord Validations.

Article Link: https://lnkd.in/eikXrbTZ

--

--

--

Experienced Software Engineer with a demonstrated history of working in the HRTech and EdTech industry. Connect @ https://www.linkedin.com/in/ayushbillore/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Our biggest update ever: Today, we’re releasing Jovo Framework v1.0 πŸŽ‰

Realtime Fastly logs with Grafana Loki for under $1 a day

Sequence Unpacking in Python

I Love My Team

Clean Code: Naming

Live Shipment Tracking for your UPS Shipmentsβ€Šβ€”β€ŠWooCommerce Shipment Tracking [v2.4.0]β€Šβ€”β€ŠPluginHive

I speak English, Spanish, Russian, Sicilian, and JavaScript

Restricting Picklist Values with Flow Builder and a Validation Rule

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ayush Billore

Ayush Billore

Experienced Software Engineer with a demonstrated history of working in the HRTech and EdTech industry. Connect @ https://www.linkedin.com/in/ayushbillore/

More from Medium

CodeClimate Setup For Ruby On Rails Project

What is Ruby on Rails (RoR)?

Save Data Automatically with Ruby on Rails

Magical Bulk Insertion in Rails 6