[PATCH aeolus-image-rubygem 2/3] WarehouseModel objects now implement a set_attr instance method.

Matt Wagner matt.wagner at redhat.com
Tue Dec 13 19:12:56 UTC 2011


This was previously available only on bucket objects.
A bucket_object method is provided to access @obj.
---
 .../model/warehouse/warehouse_model.rb             |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/lib/aeolus_image/model/warehouse/warehouse_model.rb b/lib/aeolus_image/model/warehouse/warehouse_model.rb
index ab2498e..dae77f8 100644
--- a/lib/aeolus_image/model/warehouse/warehouse_model.rb
+++ b/lib/aeolus_image/model/warehouse/warehouse_model.rb
@@ -52,6 +52,19 @@ module Aeolus
           uuid
         end
 
+        # Returns the bucket object represending this object
+        def bucket_object
+          @obj
+        end
+
+        # Set (and immediately update) an attribute on the object
+        # TODO: It might be nicer to offer a .save! that iterates over each attribute
+        # and calls this, to better match ActiveResource
+        def set_attr(key, value)
+          bucket_object.set_attr(key, value)
+        end
+
+
         class << self
           attr_accessor :warehouse, :bucket, :bucket_name
 
-- 
1.7.6.4




More information about the aeolus-devel mailing list