Skip to content

Commit

Permalink
update url validation
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelminter committed Sep 20, 2012
1 parent 29518ac commit 52d9025
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions models/fracture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ class Fracture
include DataMapper::Resource

property :id, Serial
property :url, String, :length => 200, :required => true, :format => /\./
property :url, String, :length => 200, :required => true, :format => :url
property :encoded_uri, String
property :created_at, DateTime

has n, :activities

# validates_format_of :url, :with => /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/, :message => 'Not a valid URL format'

before :save, :check_url

before :valid?, :check_url
# after :save, :encode_uri
after :update, :pusher_app

Expand Down

0 comments on commit 52d9025

Please sign in to comment.