aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-09-04 14:06:40 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-09-04 14:06:40 -0300
commit703a2e8da1d3a68b3902d9024c6f0d1cd32435aa (patch)
treea776ced223b0cb773a8d26ca29892ad02d6a9d3f /activemodel
parent40f9407b872add660db45e59316a5a195f16d563 (diff)
downloadrails-703a2e8da1d3a68b3902d9024c6f0d1cd32435aa.tar.gz
rails-703a2e8da1d3a68b3902d9024c6f0d1cd32435aa.tar.bz2
rails-703a2e8da1d3a68b3902d9024c6f0d1cd32435aa.zip
Remove example file
This documentation should be in the guides. Closes #16691
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/examples/validations.rb30
1 files changed, 0 insertions, 30 deletions
diff --git a/activemodel/examples/validations.rb b/activemodel/examples/validations.rb
deleted file mode 100644
index b8e74acd5e..0000000000
--- a/activemodel/examples/validations.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require File.expand_path('../../../load_paths', __FILE__)
-require 'active_model'
-
-class Person
- include ActiveModel::Conversion
- include ActiveModel::Validations
-
- validates :name, presence: true
-
- attr_accessor :name
-
- def initialize(attributes = {})
- @name = attributes[:name]
- end
-
- def persist
- @persisted = true
- end
-
- def persisted?
- @persisted
- end
-end
-
-person1 = Person.new
-p person1.valid? # => false
-p person1.errors.messages # => {:name=>["can't be blank"]}
-
-person2 = Person.new(name: 'matz')
-p person2.valid? # => true