From: David Lutterkort <[email protected]>
It also needs to be available for collections, which do not derive from Base
---
server/lib/cimi/models/base.rb | 7 -------
server/lib/cimi/models/resource.rb | 7 +++++++
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/server/lib/cimi/models/base.rb b/server/lib/cimi/models/base.rb
index e7fd358..dcffcf2 100644
--- a/server/lib/cimi/models/base.rb
+++ b/server/lib/cimi/models/base.rb
@@ -141,13 +141,6 @@ module CIMI::Model
self
end
- def validate!(format=:xml)
- failed_attrs = self.class.required_attributes.map do |attr|
- attr.send("#{format}_name") unless attr.valid?(send(attr.name))
- end.compact
- raise CIMI::Model::ValidationError.new(failed_attrs, format) unless
failed_attrs.empty?
- end
-
# FIXME: Kludge around the fact that we do not have proper *Create
# objects that deserialize properties by themselves
def extract_properties!(data)
diff --git a/server/lib/cimi/models/resource.rb
b/server/lib/cimi/models/resource.rb
index ad62e49..246b135 100644
--- a/server/lib/cimi/models/resource.rb
+++ b/server/lib/cimi/models/resource.rb
@@ -184,6 +184,13 @@ module CIMI
end
end
+ def validate!(format=:xml)
+ failed_attrs = self.class.required_attributes.map do |attr|
+ attr.send("#{format}_name") unless attr.valid?(send(attr.name))
+ end.compact
+ raise CIMI::Model::ValidationError.new(failed_attrs, format) unless
failed_attrs.empty?
+ end
+
def base_id
self.id || @base_id
end
--
1.8.1.2