add Specimen#properties
authorTom Clegg <tom@clinicalfuture.com>
Mon, 28 Jan 2013 23:16:03 +0000 (15:16 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Mon, 28 Jan 2013 23:16:03 +0000 (15:16 -0800)
app/models/specimen.rb
db/migrate/20130128231343_add_properties_to_specimen.rb [new file with mode: 0644]
db/schema.rb

index 89375104f47f86f7b5c015b8116be09bb30443fe..15a0c3bf414031357e5cd6d50d806b4404a02530 100644 (file)
@@ -2,8 +2,15 @@ class Specimen < OrvosModel
   include AssignUuid
   include KindAndEtag
   include CommonApiTemplate
+  serialize :properties, Hash
 
   api_accessible :superuser, :extend => :common do |t|
     t.add :material
+    t.add :properties
+  end
+
+  def properties
+    @properties ||= Hash.new
+    super
   end
 end
diff --git a/db/migrate/20130128231343_add_properties_to_specimen.rb b/db/migrate/20130128231343_add_properties_to_specimen.rb
new file mode 100644 (file)
index 0000000..e00b7a1
--- /dev/null
@@ -0,0 +1,5 @@
+class AddPropertiesToSpecimen < ActiveRecord::Migration
+  def change
+    add_column :specimens, :properties, :text
+  end
+end
index 8507e0cdf29c3001ea2c5055ae5a335f278c8fb6..7b8c9a8b395540ed07e0718dd38947f47f3809ab 100644 (file)
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20130128202518) do
+ActiveRecord::Schema.define(:version => 20130128231343) do
 
   create_table "api_client_authorizations", :force => true do |t|
     t.string   "api_token",               :null => false
@@ -186,6 +186,7 @@ ActiveRecord::Schema.define(:version => 20130128202518) do
     t.datetime "modified_at"
     t.string   "material"
     t.datetime "updated_at"
+    t.text     "properties"
   end
 
   add_index "specimens", ["uuid"], :name => "index_specimens_on_uuid", :unique => true