Validation limit values


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


I’d like to use something like: :less_than_or_equal_to=> :variable


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs