@@ -68,7 +68,7 @@ def add(attribute, message = nil, options = {})
68
68
# Will add an error message to each of the attributes in +attributes+ that is empty.
69
69
def add_on_empty ( attributes , custom_message = nil )
70
70
[ attributes ] . flatten . each do |attribute |
71
- value = @base . instance_eval { read_attribute_for_validation ( attribute ) }
71
+ value = @base . send ( :read_attribute_for_validation , attribute )
72
72
is_empty = value . respond_to? ( :empty? ) ? value . empty? : false
73
73
add ( attribute , :empty , :default => custom_message ) unless !value . nil? && !is_empty
74
74
end
@@ -77,7 +77,7 @@ def add_on_empty(attributes, custom_message = nil)
77
77
# Will add an error message to each of the attributes in +attributes+ that is blank (using Object#blank?).
78
78
def add_on_blank ( attributes , custom_message = nil )
79
79
[ attributes ] . flatten . each do |attribute |
80
- value = @base . instance_eval { read_attribute_for_validation ( attribute ) }
80
+ value = @base . send ( :read_attribute_for_validation , attribute )
81
81
add ( attribute , :blank , :default => custom_message ) if value . blank?
82
82
end
83
83
end
@@ -146,7 +146,7 @@ def generate_message(attribute, message = :invalid, options = {})
146
146
defaults = defaults . compact . flatten << :"messages.#{ message } "
147
147
148
148
key = defaults . shift
149
- value = @base . instance_eval { read_attribute_for_validation ( attribute ) }
149
+ value = @base . send ( :read_attribute_for_validation , attribute )
150
150
151
151
options = { :default => defaults ,
152
152
:model => @base . class . name . humanize ,
0 commit comments