I have a model with a validation. At runtime, I'd like to change a value of the validation. For example:
in the model bid.rb:
class Bid ActiveRecord::Base
@foo = Foo.find(1)
validates_inclusion_of :amt, :in =>
[email protected], :message => "must be between 1 and #{@foo.bar}"
end
and in the application_controller (pseudocode):
if today == 'wednesday'
Foo.update(1, :bar => 10)
else
Foo.update(1, :bar => 5)
end
However, this setup isn't working. The "foo" attribute never updates. It seems that the validation code is set only when the dev server starts and then doesn't change.