spec/fake_app/server.rb in validates_host-0.3.1 vs spec/fake_app/server.rb in validates_host-1.0.0
- old
+ new
@@ -1,5 +1,17 @@
-class Server < ActiveRecord::Base
+class Server
+ include ActiveModel::Validations
+ include ActiveModel::Conversion
+ extend ActiveModel::Naming
+
+ attr_accessor :domain_name, :host_name, :ip
+
validates :domain_name, :domain_name => true
validates :host_name, :host_name => true
validates :ip, :ip => true
+
+ def initialize(attributes = {})
+ attributes.each do |name, value|
+ send("#{name}=", value)
+ end
+ end
end
\ No newline at end of file