diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-03 07:29:30 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-03 07:29:30 +0000 |
commit | 1448d749f59bf5c964fb646d0b6fb7a0614ad4c5 (patch) | |
tree | c7b17ddcc289ed33c599129f43a88e6fe314bde4 /railties | |
parent | 1e145099a78688d25f2cfcafe58afbd651bf7be4 (diff) | |
download | rails-1448d749f59bf5c964fb646d0b6fb7a0614ad4c5.tar.gz rails-1448d749f59bf5c964fb646d0b6fb7a0614ad4c5.tar.bz2 rails-1448d749f59bf5c964fb646d0b6fb7a0614ad4c5.zip |
Fixed the scaffold generator to fail right away if the database isn't accessible instead of in mid-air #1169 [Chad Fowler]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2111 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb | 48 |
2 files changed, 26 insertions, 24 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 6ae02fcb37..0c73d68d5f 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed the scaffold generator to fail right away if the database isn't accessible instead of in mid-air #1169 [Chad Fowler] + * Corrected project-local generator location in scripts.rb #2010 [Michael Schuerig] * Don't require the environment just to clear the logs #2093 [Scott Barron] diff --git a/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb index 5c744e8af9..7c46869f5e 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +++ b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb @@ -58,9 +58,6 @@ class ScaffoldGenerator < Rails::Generator::NamedBase def manifest record do |m| - # Depend on model generator but skip if the model exists. - m.dependency 'model', [singular_name], :collision => :skip - # Check for class naming collisions. m.class_collisions controller_class_path, "#{controller_class_name}Controller", "#{controller_class_name}ControllerTest", "#{controller_class_name}Helper" @@ -70,6 +67,30 @@ class ScaffoldGenerator < Rails::Generator::NamedBase m.directory File.join('app/views', controller_class_path, controller_file_name) m.directory File.join('test/functional', controller_class_path) + # Scaffolded forms. + m.complex_template "form.rhtml", + File.join('app/views', + controller_class_path, + controller_file_name, + "_form.rhtml"), + :insert => 'form_scaffolding.rhtml', + :sandbox => lambda { create_sandbox }, + :begin_mark => 'form', + :end_mark => 'eoform', + :mark_id => singular_name + + # Depend on model generator but skip if the model exists. + m.dependency 'model', [singular_name], :collision => :skip + + # Scaffolded views. + scaffold_views.each do |action| + m.template "view_#{action}.rhtml", + File.join('app/views', + controller_class_path, + controller_file_name, + "#{action}.rhtml"), + :assigns => { :action => action } + end # Controller class, functional test, helper, and views. m.template 'controller.rb', @@ -91,27 +112,6 @@ class ScaffoldGenerator < Rails::Generator::NamedBase m.template 'layout.rhtml', "app/views/layouts/#{controller_file_name}.rhtml" m.template 'style.css', 'public/stylesheets/scaffold.css' - # Scaffolded views. - scaffold_views.each do |action| - m.template "view_#{action}.rhtml", - File.join('app/views', - controller_class_path, - controller_file_name, - "#{action}.rhtml"), - :assigns => { :action => action } - end - - # Scaffolded forms. - m.complex_template "form.rhtml", - File.join('app/views', - controller_class_path, - controller_file_name, - "_form.rhtml"), - :insert => 'form_scaffolding.rhtml', - :sandbox => lambda { create_sandbox }, - :begin_mark => 'form', - :end_mark => 'eoform', - :mark_id => singular_name # Unscaffolded views. unscaffolded_actions.each do |action| |