Topic: attribute.length in named_scope query.. syntax
Hey.
I have this as a named scope in my Account model
named_scope :with_country_code, lambda { { :conditions => ['country IS NOT NULL'] } }
which is working..
but its also returning records where the 'country' is "" (nothing, but not NULL)
so i was wanting to add in something like :conditions => ['country IS NOT NULL AND country.length =? 2']
But that syntax is wrong.. Could someone please point me in the right direction on getting the length of the attribute in the query? thanks!