Permalink
Browse files

Resource generator depends on the model generator rather than duplica…

…ting it. Closes #7269.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6069 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 7ce6753 commit 5224b62ae360d35891e562918a438ab4761ecf1f @jeremy jeremy committed Jan 28, 2007
View
@@ -1,5 +1,7 @@
*SVN*
+* Resource generator depends on the model generator rather than duplicating it. #7269 [bscofield]
+
* Add/Update usage documentation for script/destroy, resource generator and scaffold_resource generator. Closes #7092, #7271, #7267. [bscofield]
* Update to script.aculo.us 1.7.0. [Thomas Fuchs]
@@ -39,27 +39,14 @@ def manifest
m.directory(File.join('test/functional', controller_class_path))
m.directory(File.join('test/unit', class_path))
- m.template('model.rb', File.join('app/models', class_path, "#{file_name}.rb"))
+ m.dependency 'model', [singular_name] + @args, :collision => :skip
m.template(
'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
)
m.template('functional_test.rb', File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
- m.template('unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb"))
- m.template('fixtures.yml', File.join('test/fixtures', "#{table_name}.yml"))
-
- unless options[:skip_migration]
- m.migration_template(
- 'migration.rb', 'db/migrate',
- :assigns => {
- :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}",
- :attributes => attributes
- },
- :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
- )
- end
m.route_resources controller_file_name
end
@@ -1,11 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-one:
- id: 1
-<% for attribute in attributes -%>
- <%= attribute.name %>: <%= attribute.default %>
-<% end -%>
-two:
- id: 2
-<% for attribute in attributes -%>
- <%= attribute.name %>: <%= attribute.default %>
-<% end -%>
@@ -1,13 +0,0 @@
-class <%= migration_name %> < ActiveRecord::Migration
- def self.up
- create_table :<%= table_name %> do |t|
-<% for attribute in attributes -%>
- t.column :<%= attribute.name %>, :<%= attribute.type %>
-<% end -%>
- end
- end
-
- def self.down
- drop_table :<%= table_name %>
- end
-end
@@ -1,2 +0,0 @@
-class <%= class_name %> < ActiveRecord::Base
-end
@@ -1,10 +0,0 @@
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
-
-class <%= class_name %>Test < Test::Unit::TestCase
- fixtures :<%= table_name %>
-
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end

0 comments on commit 5224b62

Please sign in to comment.