This project is archived and is in readonly mode.

#6467 new
Chris Baker

active model range validator

Reported by Chris Baker | February 25th, 2011 @ 12:45 AM

This patch creates a range validator for active model. In the simplest case, it validates that a field is a range, e.g.

validates :field, :range => true

It is also capable of validating that the range does or does not overlap with other ranges in other models, e.g.

validates :field, :range => { :not_overlapping => Proc.new{ |record| record.other_records } } validates :field, :range => { :overlapping => :other_records }

I provided some more examples of usage on the github page where I maintain this code as a gem: https://github.com/chrisb87/range_validator

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages