From 703a2e8da1d3a68b3902d9024c6f0d1cd32435aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Thu, 4 Sep 2014 14:06:40 -0300 Subject: Remove example file This documentation should be in the guides. Closes #16691 --- activemodel/examples/validations.rb | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 activemodel/examples/validations.rb (limited to 'activemodel') 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 -- cgit v1.2.3