diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-10-28 07:50:42 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-10-28 07:50:42 +0000 |
commit | 9bafd3537554d07b96b9edf049ff48ce262c30ac (patch) | |
tree | 6b2de5a09ea32564cedddfba893284e980341c91 /railties/lib/rails_generator/generators/components/scaffold | |
parent | bc73b838e04a13531523621b11083e9a371d778c (diff) | |
download | rails-9bafd3537554d07b96b9edf049ff48ce262c30ac.tar.gz rails-9bafd3537554d07b96b9edf049ff48ce262c30ac.tar.bz2 rails-9bafd3537554d07b96b9edf049ff48ce262c30ac.zip |
Fixed scaffold generator when started with only 1 parameter (closes #2609) [self@mattmower.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2780 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/rails_generator/generators/components/scaffold')
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb | 9 |
1 files changed, 8 insertions, 1 deletions
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 7987e888e0..7ac2ac76e9 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +++ b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb @@ -46,9 +46,16 @@ class ScaffoldGenerator < Rails::Generator::NamedBase def initialize(runtime_args, runtime_options = {}) super - @controller_name = args.shift or (ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name) + + if runtime_args.length > 1 + @controller_name = runtime_args[1] + else + @controller_name = (ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name) + end + base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name) @controller_class_name_without_nesting, @controller_singular_name, @controller_plural_name = inflect_names(base_name) + if @controller_class_nesting.empty? @controller_class_name = @controller_class_name_without_nesting else |