You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/11/30 17:11:31 UTC

[PATCH core 2/2] CIMI: Fix strange issue with Fedora MRI and Datamapper associations

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/db/provider.rb | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/server/lib/db/provider.rb b/server/lib/db/provider.rb
index 54fe2d7..25e2ca9 100644
--- a/server/lib/db/provider.rb
+++ b/server/lib/db/provider.rb
@@ -10,6 +10,17 @@ module Deltacloud
 
       has n, :entities
       has n, :machine_templates
+
+      # This is a workaround for strange bug in Fedora MRI:
+      #
+      def machine_templates
+        MachineTemplate.all(:provider_id => self.id)
+      end
+
+      def entities
+        Entity.all(:provider_id => self.id)
+      end
+
     end
 
   end
-- 
1.8.0


Re: [PATCH core 2/2] CIMI: Fix strange issue with Fedora MRI and Datamapper associations

Posted by Michal Fojtik <mf...@redhat.com>.
On 11/30, mfojtik@redhat.com wrote:

I offer bottle of beer to the one who can explain me why this is needed in
Fedora MRI (1.9.3) and why under rbenv 1.9.3 (same patchlevel) it works
without this workaround :-)

  -- Michal

> From: Michal Fojtik <mf...@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
>  server/lib/db/provider.rb | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/server/lib/db/provider.rb b/server/lib/db/provider.rb
> index 54fe2d7..25e2ca9 100644
> --- a/server/lib/db/provider.rb
> +++ b/server/lib/db/provider.rb
> @@ -10,6 +10,17 @@ module Deltacloud
>  
>        has n, :entities
>        has n, :machine_templates
> +
> +      # This is a workaround for strange bug in Fedora MRI:
> +      #
> +      def machine_templates
> +        MachineTemplate.all(:provider_id => self.id)
> +      end
> +
> +      def entities
> +        Entity.all(:provider_id => self.id)
> +      end
> +
>      end
>  
>    end
> -- 
> 1.8.0
> 

-- 
Michal Fojtik <mf...@redhat.com>
Deltacloud API, CloudForms