end
end
end
+
+ def assign_uuid
+ if self.manifest_text.nil? and self.uuid.nil?
+ super
+ elsif self.manifest_text and self.uuid
+ if self.uuid == Digest::MD5.hexdigest(self.manifest_text)
+ true
+ else
+ errors.add :uuid, 'uuid does not match checksum of manifest_text'
+ false
+ end
+ elsif self.manifest_text
+ errors.add :uuid, 'checksum for manifest_text not supplied in uuid'
+ false
+ else
+ errors.add :manifest_text, 'manifest_text not supplied'
+ false
+ end
+ end
end
--- /dev/null
+class AddManifestTextToCollection < ActiveRecord::Migration
+ def change
+ add_column :collections, :manifest_text, :text
+ end
+end
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130128231343) do
+ActiveRecord::Schema.define(:version => 20130130205749) do
create_table "api_client_authorizations", :force => true do |t|
t.string "api_token", :null => false
t.integer "redundancy_confirmed_as"
t.datetime "updated_at"
t.string "uuid"
+ t.text "manifest_text"
end
add_index "collections", ["uuid"], :name => "index_collections_on_uuid", :unique => true