# Validation limit values

**URL:** <https://www.ruby-forum.com/t/validation-limit-values/141948>\
**Category:** Rails\
**Created:** [July 1, 2008, 11:56pm UTC](https://www.ruby-forum.com/t/validation-limit-values/141948 "2008-07-01T23:56:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![billv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bb73d2/32.png) [@billv](https://www.ruby-forum.com/u/billv)\
**Post date:** [July 1, 2008, 11:56pm UTC](https://www.ruby-forum.com/t/validation-limit-values/141948/1 "2008-07-01T23:56:10Z")

</div>

Hi,

Is there a way to set the validate\_numericality\_of limit to a variable  
passed in from the controller? I have this model:

class Vision \< ActiveRecord::Base

belongs\_to :employee  
belongs\_to :users

validates\_numericality\_of :paid\_amount, :on  
=\> :update, :less\_than\_or\_equal\_to =\> 250, :allow\_nil =\> true  
validates\_numericality\_of :cost, :allow\_nil =\> false

end

I’d like to use something like: :less\_than\_or\_equal\_to=\> :variable

Thanks.
