myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3400] branches/wf4ever/app: fixed runtime error


From: noreply
Subject: [myexperiment-hackers] [3400] branches/wf4ever/app: fixed runtime error when adding relationships
Date: Wed, 6 Feb 2013 01:13:13 +0000 (UTC)

Revision
3400
Author
dgc
Date
2013-02-06 01:13:12 +0000 (Wed, 06 Feb 2013)

Log Message

fixed runtime error when adding relationships

Modified Paths

Diff

Modified: branches/wf4ever/app/controllers/relationships_controller.rb (3399 => 3400)


--- branches/wf4ever/app/controllers/relationships_controller.rb	2013-02-06 01:12:00 UTC (rev 3399)
+++ branches/wf4ever/app/controllers/relationships_controller.rb	2013-02-06 01:13:12 UTC (rev 3400)
@@ -29,11 +29,11 @@
   # POST /:context_type/:context_id/relationships
   def create 
 
-    subject_name = URI::decode(params[:subject])
-    object_name  = URI::decode(params[:object])
+    subject_relative_uri = URI::decode(params[:subject])
+    object_relative_uri  = URI::decode(params[:object])
 
-    subject = @context.contributable_entries.find_by_name(subject_name)
-    object  = @context.contributable_entries.find_by_name(object_name)
+    subject = @context.contributable_entries.find_by_relative_uri(subject_relative_uri)
+    object  = @context.contributable_entries.find_by_relative_uri(object_relative_uri)
 
     match = params[:predicate].match("(.*[#/])([^#/]+)")
 
@@ -42,8 +42,8 @@
 
     session = ROSRS::Session.new(@context.ro_uri, Conf.rodl_bearer_token)
 
-    subject_uri = "address@hidden::encode(subject.name)}"
-    object_uri  = "address@hidden::encode(object.name)}"
+    subject_uri = "address@hidden::encode(subject.ro_local_uri)}"
+    object_uri  = "address@hidden::encode(object.ro_local_uri)}"
 
     ao_body = <<RDF
 <rdf:RDF

Modified: branches/wf4ever/app/models/pack.rb (3399 => 3400)


--- branches/wf4ever/app/models/pack.rb	2013-02-06 01:12:00 UTC (rev 3399)
+++ branches/wf4ever/app/models/pack.rb	2013-02-06 01:13:12 UTC (rev 3400)
@@ -104,13 +104,14 @@
     end
   end
 
-  def find_by_name(name)
+  def find_by_relative_uri(relative_uri)
     @entries.each do |entry|
-      return entry if entry.name == name
+      return entry if entry.uri == @pack.ro_uri + relative_uri
     end
 
     nil 
   end
+
 end
 
 class Pack < ActiveRecord::Base

reply via email to

[Prev in Thread] Current Thread [Next in Thread]