In my model, I have several scopes defined such as:
scope :myScope1, where('myField IS NULL')
This works, but I don't need to check for 'Null' - I need to check for '.blank?' - because there are cases of non-nulls which are 'blank' in the DB, which I need to include. I can use '.blank?' in my class-defs (and do - and they work there), but I cannot use this in this current context.
I have not been able to find a syntax (of the non-depreciated variety) which will work for this. Thanks.
Try
scope :myScope1, where("myField IS NULL or CAST(myField as text) = ''")
It's not that simple as blank?
, but I can't see a simple enough solution.