myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2251] trunk: model for controlled vocabularies


From: noreply
Subject: [myexperiment-hackers] [2251] trunk: model for controlled vocabularies
Date: Wed, 29 Jul 2009 11:17:04 -0400 (EDT)

Revision
2251
Author
dgc
Date
2009-07-29 11:17:03 -0400 (Wed, 29 Jul 2009)

Log Message

model for controlled vocabularies

Modified Paths

Added Paths

Diff

Added: trunk/app/models/vocabulary.rb (0 => 2251)


--- trunk/app/models/vocabulary.rb	                        (rev 0)
+++ trunk/app/models/vocabulary.rb	2009-07-29 15:17:03 UTC (rev 2251)
@@ -0,0 +1,14 @@
+# myExperiment: app/models/vocabulary.rb
+#
+# Copyright (c) 2009 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class Vocabulary < ActiveRecord::Base
+
+  belongs_to :user
+
+  validates_presence_of :title
+
+  format_attribute :description
+end
+

Added: trunk/db/migrate/081_add_controlled_vocab.rb (0 => 2251)


--- trunk/db/migrate/081_add_controlled_vocab.rb	                        (rev 0)
+++ trunk/db/migrate/081_add_controlled_vocab.rb	2009-07-29 15:17:03 UTC (rev 2251)
@@ -0,0 +1,33 @@
+# myExperiment: db/migrate/081_add_controlled_vocab.rb
+#
+# Copyright (c) 2007 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class AddControlledVocab < ActiveRecord::Migration
+  def self.up
+    create_table :vocabularies do |t|
+      t.column :user_id,          :integer
+      t.column :title,            :string
+      t.column :description,      :text
+      t.column :description_html, :text
+      t.column :created_at,       :datetime
+      t.column :updated_at,       :datetime
+    end
+
+    add_column :tags, :vocabulary_id,    :integer
+    add_column :tags, :description,      :text
+    add_column :tags, :description_html, :text
+    add_column :tags, :created_at,       :datetime
+    add_column :tags, :updated_at,       :datetime
+  end
+
+  def self.down
+    drop_table :vocabularies
+
+    remove_column :tags, :vocabulary_id
+    remove_column :tags, :description
+    remove_column :tags, :description_html
+    remove_column :tags, :created_at
+    remove_column :tags, :updated_at
+  end
+end

Modified: trunk/vendor/plugins/acts_as_taggable_redux/lib/tag.rb (2250 => 2251)


--- trunk/vendor/plugins/acts_as_taggable_redux/lib/tag.rb	2009-07-29 15:13:20 UTC (rev 2250)
+++ trunk/vendor/plugins/acts_as_taggable_redux/lib/tag.rb	2009-07-29 15:17:03 UTC (rev 2251)
@@ -1,5 +1,6 @@
 class Tag < ActiveRecord::Base
   has_many :taggings
+  belongs_to :vocabulary
 
   # Parse a text string into an array of tokens for use as tags
   def self.parse(list)

reply via email to

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