Last active
February 14, 2024 11:39
-
-
Save brenes/4503386 to your computer and use it in GitHub Desktop.
Revisions
-
brenes revised this gist
Sep 10, 2015 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ # We have to remove validations on email, as it's no longer needed. # Based on a solution found at http://stackoverflow.com/questions/7545938/how-to-remove-validation-using-instance-eval-clause-in-rails Model.class_eval do _validators.delete(:template) _validate_callbacks.each do |callback| if callback.raw_filter.respond_to? :attributes callback.raw_filter.attributes.delete :template end end end -
brenes created this gist
Jan 10, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ # We have to remove validations on email, as it's no longer needed. # Based on a solution found at http://stackoverflow.com/questions/7545938/how-to-remove-validation-using-instance-eval-clause-in-rails Model.class_eval do _validators.reject!{ |key, _| key == :field } _validate_callbacks.each do |callback| callback.raw_filter.attributes.delete :field end _validate_callbacks.reject! do |callback| callback.raw_filter.attributes.empty? || callback.raw_filter.attributes == [:field] end end