kaize/validates — pull request #42 by Khelek (2014-08-19 08:47:06+00:00)
Title: Dynamic length validator

Можно в association_length_validator передавать лямбду или символ, как

validates :field, association_length: { maximum: -> (record) { record.max } }
validates :field2, association_length: { maximum: -> { 3 } }
validates :field3, association_length: { maximum: :max }