Permalink
Browse files

Subdomain string validation added. Closes #1

  • Loading branch information...
1 parent 4866bf9 commit 48c93dfc6359be97b554386ee17ff5fb220fd90b @nmanzi committed Oct 9, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 app/models/link.rb
View
@@ -2,7 +2,8 @@ class Link < ActiveRecord::Base
validates :subdomain,
:exclusion => { :in => %w(www us ca jp), :message => "%{value} is reserved." },
:uniqueness => true,
- :presence => true
+ :presence => true,
+ :format => { :with => /\A([a-zA-Z]|\d)*\Z/ }
validates :url, :presence => true, :url => true
before_save :set_defaults
after_initialize :set_suggested_subdomain

0 comments on commit 48c93df

Please sign in to comment.