spec/dummy/app/models/post.rb in validation_sync-0.0.4 vs spec/dummy/app/models/post.rb in validation_sync-0.0.5
- old
+ new
@@ -1,10 +1,21 @@
class Post < ActiveRecord::Base
- validates_presence_of :title, :message => "you need a title, bor"
+ # Title
+ validates_presence_of :title, :message => "You need a title, bro."
+ validates_length_of :title, :minimum => 5
- validates_length_of :title, :minimum => 5, :maximum => 15, :allow_blank => true
-
+ # View Count
validates_presence_of :view_count
- validates_numericality_of :view_count, :message => "NUMBERZ ONLY!"
+ validates_numericality_of :view_count
+
+ # Order
+ validates_numericality_of :order, :message => "Make that shit a number!", :allow_nil => true
+
+ # User ID
+ validates_numericality_of :user_id, :message => "User ID Must be a number."
+
+ # Content
+ validates_presence_of :content
+ validates_length_of :content, :maximum => 140
end