Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved links default assignment into a before_save

  • Loading branch information...
commit 35f2fd27bee4335dd820dbb0a7fac1d95e1ef5f1 1 parent 71abf5b
@nmanzi authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  app/models/link.rb
View
3  app/models/link.rb
@@ -4,9 +4,10 @@ class Link < ActiveRecord::Base
:uniqueness => true,
:presence => true
validates :url, :presence => true, :url => true
- after_initialize :set_defaults
+ before_save :set_defaults
def set_defaults
self.visits ||= 0
end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.