Hello,
I am working with URL validations. I want this validation to be optional if the data exists in the form submission. I have tried several things.
validates_format_of :website, :if => params[:organization][:website], :with => /((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z] {2,5}(([0-9]{1,5})?\/.*)?/, :message => "Please enter a valid url"
Of course the challenge is in the :if statement
I won't bother you guys with all of my experiments, but I have tried using :website, :website.length > 0, params[:organization][:website] and creating a method in my organization class. None of these have worked. What am I missing?
Thanks!