public
Clone URL: git://github.com/edspencer/ext-rails-app-generator.git
Started model generator
edspencer (author)
Mon Aug 25 10:31:38 -0700 2008
commit  699e2809c286ceae579e061014d2e6eb1c9749e0
tree    e22564907244136fcf22b811db5a7240037c58ee
parent  a3da0b1d2c5e43a35634b98e73923413b421a82e
...
4
5
6
7
 
8
9
...
4
5
6
 
7
8
9
0
@@ -4,6 +4,6 @@ class Association < ActiveRecord::Base
0
   belongs_to :model
0
   belongs_to :foreign_model, :class_name => 'Model'
0
   
0
- validates_presence_of :association_type, :model_id, :foreign_model_id
0
+ validates_presence_of :association_type, :model_id, :foreign_model_id
0
   validates_inclusion_of :association_type, :in => ASSOCIATION_TYPES
0
 end
...
1
2
 
3
4
5
...
1
2
3
4
5
6
0
@@ -1,5 +1,6 @@
0
 class Column < ActiveRecord::Base
0
   belongs_to :model
0
+ has_many :validations
0
   
0
   validates_presence_of :model_id, :name, :column_type
0
 end
...
1
2
3
 
4
5
6
7
8
 
 
 
 
9
...
1
2
 
3
4
5
6
7
8
9
10
11
12
13
0
@@ -1,9 +1,13 @@
0
 class Model < ActiveRecord::Base
0
   has_many :columns
0
- has_many :validations
0
+ has_many :validations, :through => :columns
0
   has_many :associations
0
   belongs_to :site
0
   has_many :controllers
0
   
0
   validates_presence_of :site_id, :name
0
+
0
+ def generate!
0
+ Rails::Generator::Scripts::Generate.new.run(['generated_model', self.name, self])
0
+ end
0
 end
...
4
5
6
 
7
...
4
5
6
7
8
0
@@ -4,4 +4,5 @@ describe Column do
0
   it_should_be_createable :with => {:model_id => 1, :name => 'test', :column_type => 'string'}
0
   it_should_validate_presence_of :model_id, :name, :column_type
0
   it_should_belong_to :model
0
+ it_should_have_many :validations
0
 end

Comments

    No one has commented yet.