{"id":114,"date":"2014-07-02T15:39:50","date_gmt":"2014-07-02T15:39:50","guid":{"rendered":"https:\/\/www.lianeallen.com\/home\/?p=114"},"modified":"2014-07-02T15:41:02","modified_gmt":"2014-07-02T15:41:02","slug":"rails-url-validation","status":"publish","type":"post","link":"https:\/\/www.lianeallen.com\/home\/2014\/07\/rails-url-validation\/","title":{"rendered":"Rails URL Validation"},"content":{"rendered":"<p>See <a href=\"http:\/\/www.intridea.com\/blog\/2009\/2\/18\/quick-tip-url-validation-in-rails\n\">Michael Bleigh&#8217;s original post for details.<\/a><\/p>\n<p>But in the mean time, taking advantage of the regular expression method of the URI class lets you do this for validating URLs:<\/p>\n<blockquote><p>class Web<br \/>\n  validates_format_of :website, :with => URI::regexp(%w(http https))<br \/>\nend<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>See Michael Bleigh&#8217;s original post for details. But in the mean time, taking advantage of the regular expression method of the URI class lets you do this for validating URLs: class Web validates_format_of :website, :with => URI::regexp(%w(http https)) end<\/p>\n","protected":false},"author":2,"featured_media":115,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-114","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/comments?post=114"}],"version-history":[{"count":2,"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":117,"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/posts\/114\/revisions\/117"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/media\/115"}],"wp:attachment":[{"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/media?parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/categories?post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lianeallen.com\/home\/wp-json\/wp\/v2\/tags?post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}