I have some validations that need to include an :if clause using the
Class and not the model.
Sounds reasonably straight forward at first by doing this:
validates_presence_of :field_one, :field_two, :if =>
Proc.new{|MyClass| MyClass.feature_is_enabled}
And that works. The problem occurs when I do mor ethan one validation
that way.
validates_presence_of :field_one, :field_two, :if =>
Proc.new{|MyClass| MyClass.feature_is_enabled}
validates_numericality_of :field_three, :field_four, :if =>
Proc.new{|MyClass| MyClass.feature_is_enabled}
That generates a "constant already defined" error. I suspect it has to
be complaining about the |MyClass| part, but I can't think of what else
to do there.
Any ideas? Thx.
-- gw
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.