1 Reply Latest reply on Mar 28, 2014 5:36 AM by Kutir Mobility

    Incorrect use of is_blob_attrib in Rhom object

    Gerbrand Stap

      We had a bug in our application recently where we had a typo when getting the value of a property of a FixedSchema Rhom object. Getting a non-existing property will always return 'nil', so instead of getting our value, the code silently failed and returned nothing.

      We've decided to adapt Rhom objects to make sure that such a typo will cause an error. It turns out that this can be done by redefining the method_missing method. After we did this, we came across two calls to an instance method 'is_blob_attrib', which should be a call to the class method 'is_blob_attrib'. These calls would also silently fail and thus return nil (which is interpreted as 'false' in these cases), but now raise an error.

       

      I assume that this is a bug, but what are the consequences of these calls always returning nil?

      What if we'd fix this by creating an instance method that calls the class method, what would change?

       

      We use RhoMobile 4.0.0 and found these calls in the following locations:

      /framework/rhom/rhom_object_factory.rb, line 1612, in #save()

      /framework/rhom/rhom_object_factory.rb, line 1761, in #update_attributes( attrs )