J
J. mp
Hi
How do I know if a variable is an instace of a given class
I have a method that returns a String or an Array and I have to know
outside if the returned object is and String or an Array.
Is beacuse this :
# File vendor/rails/activerecord/lib/active_record/validations.rb,
line 100
100: def on(attribute)
101: errors = @errors[attribute.to_s]
102: return nil if errors.nil?
103: errors.size == 1 ? errors.first : errors
104: end
How do I know that call on method on returned and array or an string?
Thanks
How do I know if a variable is an instace of a given class
I have a method that returns a String or an Array and I have to know
outside if the returned object is and String or an Array.
Is beacuse this :
# File vendor/rails/activerecord/lib/active_record/validations.rb,
line 100
100: def on(attribute)
101: errors = @errors[attribute.to_s]
102: return nil if errors.nil?
103: errors.size == 1 ? errors.first : errors
104: end
How do I know that call on method on returned and array or an string?
Thanks