search for: validate_callbacks

Displaying 2 results from an estimated 2 matches for "validate_callbacks".

2011 Feb 28
1
(2.3.5) removing validations
Today I tried to remove (actually overwrite) a validation from a model, from within a plugin. This was the original validation: validates_length_of :login, :maximum => 30 This was the only code I could come up with to replace it: def self.included(base) base.class_eval do @validate_callbacks.delete_if { |callback| begin # Sorry, only way to remove validation... # Probably tightly coupled to AR 2.3.5 (callback.method.respond_to?(:binding)) && (eval("attrs", callback.method.binding).first == :login) &&...
2011 Mar 01
0
(2.3.5) removing validations
...ier) Today I tried to remove (actually overwrite) a validation from a model, from within a plugin. This was the original validation: validates_length_of :login, :maximum => 30 This was the only code I could come up with to replace it: def self.included(base) base.class_eval do @validate_callbacks.delete_if { |callback| begin (callback.method.respond_to?(:binding)) && (eval("attrs", callback.method.binding).first == :login) && (callback.options[:maximum] == 30) rescue NameError false end }...