aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/models
diff options
context:
space:
mode:
authorJosh Kalderimis <josh.kalderimis@gmail.com>2010-05-11 12:28:42 +0200
committerCarl Lerche <carllerche@mac.com>2010-05-13 13:57:37 -0700
commit9131a88bb8e82f139ec49b4057fb6065ba0a2c6a (patch)
tree5586a5c35711866acdbc2408cc70e50197229fae /activemodel/test/models
parent2203c781a7dfa8b0c8b6c97cd318d941f9fbb26c (diff)
downloadrails-9131a88bb8e82f139ec49b4057fb6065ba0a2c6a.tar.gz
rails-9131a88bb8e82f139ec49b4057fb6065ba0a2c6a.tar.bz2
rails-9131a88bb8e82f139ec49b4057fb6065ba0a2c6a.zip
validation macros can now be used within an instance
Diffstat (limited to 'activemodel/test/models')
-rw-r--r--activemodel/test/models/automobile.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activemodel/test/models/automobile.rb b/activemodel/test/models/automobile.rb
new file mode 100644
index 0000000000..021ea61c80
--- /dev/null
+++ b/activemodel/test/models/automobile.rb
@@ -0,0 +1,12 @@
+class Automobile
+ include ActiveModel::Validations
+
+ validate :validations
+
+ attr_accessor :make, :model
+
+ def validations
+ validates_presence_of :make
+ validates_length_of :model, :within => 2..10
+ end
+end \ No newline at end of file