Forum: Ruby on Rails ActiveRecord validation reflection.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
197831886ae58e6893dbf45d5116a0a9?d=identicon&s=25 rexaler (Guest)
on 2007-01-06 19:30
(Received via mailing list)
In my model class I have:
  class X < ActiveRecord:Base
    validates_length_of       :login,    :within => 3..40

In my view file I do:
    <label for="login">Login (3..40 characters)

Is there a way to query this length information?
Hence, having hard-coded "3..40" in the view is NOT good, as the length
limit may change from model definition.  I rather do something like:
    <label for="login">Login (<%= find_the_frigging_length_from_model_X
%> characters)

This topic is locked and can not be replied to.