Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Scaffold generator depends on model generator instead of duplicating …

…it. Closes #7222.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6840 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit b0b5ee958ae59f3f85c538d133f38d069e9052f5 1 parent 74265b6
@jeremy jeremy authored
View
2  railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Scaffold generator depends on model generator instead of duplicating it. #7222 [bscofield]
+
* Scaffold generator tests. #8443 [pelle]
* Generated scaffold functional tests use assert_difference. #8421 [norbert]
View
15 railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb
@@ -51,7 +51,7 @@ def manifest
m.template('layout.html.erb', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb"))
m.template('style.css', 'public/stylesheets/scaffold.css')
- 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")
@@ -59,19 +59,6 @@ def manifest
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
View
11 railties/lib/rails_generator/generators/components/scaffold/templates/fixtures.yml
@@ -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 -%>
View
13 railties/lib/rails_generator/generators/components/scaffold/templates/migration.rb
@@ -1,13 +0,0 @@
-class <%= migration_name %> < ActiveRecord::Migration
- def self.up
- create_table :<%= table_name %> do |t|
-<% for attribute in attributes -%>
- t.<%= attribute.type %> :<%= attribute.name %>
-<% end -%>
- end
- end
-
- def self.down
- drop_table :<%= table_name %>
- end
-end
View
2  railties/lib/rails_generator/generators/components/scaffold/templates/model.rb
@@ -1,2 +0,0 @@
-class <%= class_name %> < ActiveRecord::Base
-end
Please sign in to comment.
Something went wrong with that request. Please try again.