I have the following code in my urlSearch model:
def find_url(orig_url)
url = find_by(url: orig_url)
unless url
# some stuff
end
end
Here find_by will search for the exact string passed to it which is : orig_url
argument in my case.
For example, if in my table i have an url like : www.stackoverflow.com
and if i search for http://stackoverflow.com
or http://www.stackoverflow.com
, it's not the same string which means that find_by
will return nil.
Is there is a way to tell find_by
to ignore http://
and www.
when searching?