提交 5224b62a 编写于 作者: J Jeremy Kemper

Resource generator depends on the model generator rather than duplicating it. Closes #7269.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6069 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 7ce67535
*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,7 +39,7 @@ 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")
......@@ -47,19 +47,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
......
# 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 -%>
\ No newline at end of file
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
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册