tweak eager loading
authorTom Clegg <tom@clinicalfuture.com>
Mon, 28 Jan 2013 23:10:23 +0000 (15:10 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Mon, 28 Jan 2013 23:10:23 +0000 (15:10 -0800)
app/models/link.rb
app/models/log.rb
app/models/orvos_base.rb
app/models/pipeline_invocation.rb

index 41102619d15a3fcf5ba78e3d63fdeef599f3e67d..9c86e3171f778292578bc9e0dbaccd39c0890a88 100644 (file)
@@ -1,4 +1,6 @@
 class Link < OrvosBase
+  attr_accessor :head
+  attr_accessor :tail
   def self.by_tail(t, opts={})
     where(opts.merge :tail_kind => t.kind, :tail_uuid => t.uuid)
   end
index 3e3e7d850e16cbf1e2d5308ec09d90db5494f572..f6280e3016cb2eb1cf5b1c1da07bb347c3874794 100644 (file)
@@ -1,2 +1,3 @@
 class Log < OrvosBase
+  attr_accessor :object
 end
index e4eff9c93aa37ed6e587d47b70ba172538731dd2..2a84f72b16340fcd268521a74c8dbe17ca53de1c 100644 (file)
@@ -105,14 +105,14 @@ class OrvosBase < ActiveRecord::Base
       hash = $orvos_api_client.api(self.class, '/' + uuid_or_hash)
     end
     hash.each do |k,v|
-      if self.respond_to?((k.to_s + '=').to_s)
+      if self.respond_to?(k.to_s + '=')
         self.send(k.to_s + '=', v)
       else
         # When OrvosApiClient#schema starts telling us what to expect
         # in API responses (not just the server side database
         # columns), this sort of awfulness can be avoided:
         self.instance_variable_set('@' + k.to_s, v)
-        if !self.respond_to?(k.to_s)
+        if !self.respond_to? k
           singleton = class << self; self end
           singleton.send :define_method, k, lambda { instance_variable_get('@' + k.to_s) }
         end
index 0da87090b76bf9a3bd137d541d54bc133472822f..851041a97d6738b6927e8be56efb0aa881016cc0 100644 (file)
@@ -1,2 +1,3 @@
 class PipelineInvocation < OrvosBase
+  attr_accessor :pipeline
 end