myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2554] branches/neiss/vendor/plugins/structured_d


From: noreply
Subject: [myexperiment-hackers] [2554] branches/neiss/vendor/plugins/structured_data/lib: added dependent, conditions, foreign_key and class_name
Date: Tue, 1 Feb 2011 11:29:04 -0500 (EST)

Revision
2554
Author
dgc
Date
2011-02-01 11:29:04 -0500 (Tue, 01 Feb 2011)

Log Message

added dependent, conditions, foreign_key and class_name

Modified Paths

Diff

Modified: branches/neiss/vendor/plugins/structured_data/lib/auto_migrate.rb (2553 => 2554)


--- branches/neiss/vendor/plugins/structured_data/lib/auto_migrate.rb	2011-02-01 16:28:53 UTC (rev 2553)
+++ branches/neiss/vendor/plugins/structured_data/lib/auto_migrate.rb	2011-02-01 16:29:04 UTC (rev 2554)
@@ -11,8 +11,8 @@
   SCHEMA                = "config/base_schema.xml"
   SCHEMA_D              = "config/schema.d"
   COLUMN_ATTRIBUTES     = ['name', 'type', 'default']
-  BELONGS_TO_ATTRIBUTES = ['polymorphic']
-  HAS_MANY_ATTRIBUTES   = ['target', 'through', 'foreign_key', 'source']
+  BELONGS_TO_ATTRIBUTES = ['polymorphic', 'class_name', 'foreign_key']
+  HAS_MANY_ATTRIBUTES   = ['target', 'through', 'foreign_key', 'source', 'dependent', 'conditions', 'class_name']
 
   def self.schema
 

Modified: branches/neiss/vendor/plugins/structured_data/lib/structured_data.rb (2553 => 2554)


--- branches/neiss/vendor/plugins/structured_data/lib/structured_data.rb	2011-02-01 16:28:53 UTC (rev 2553)
+++ branches/neiss/vendor/plugins/structured_data/lib/structured_data.rb	2011-02-01 16:29:04 UTC (rev 2554)
@@ -25,6 +25,9 @@
           bits.push(":through => :#{association[:through]}") if association[:through]
           bits.push(":foreign_key => :#{association[:foreign_key]}") if association[:foreign_key]
           bits.push(":source => :#{association[:source]}") if association[:source]
+          bits.push(":dependent => :#{association[:dependent]}") if association[:dependent]
+          bits.push(":conditions => \"#{association[:conditions]}\"") if association[:conditions]
+          bits.push(":class_name => \"#{association[:class_name]}\"") if association[:class_name]
 
           line = "has_many #{bits.join(', ')}"
           puts "assoc: #{class_name} -> #{line}"
@@ -34,6 +37,8 @@
           bits = [":#{association[:target].singularize}"]
 
           bits.push(":polymorphic => #{association[:polymorphic]}") if association[:polymorphic]
+          bits.push(":class_name => \"#{association[:class_name]}\"") if association[:class_name]
+          bits.push(":foreign_key => :#{association[:foreign_key]}") if association[:foreign_key]
 
           line = "belongs_to #{bits.join(', ')}"
           self.class_eval(line)

reply via email to

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