fixed activerecord bug while querying using wildcards