diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-28 15:42:16 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-28 15:42:16 +0000 |
commit | d5e48ae7d278cb6e03bef104eac23ac5cad46c5a (patch) | |
tree | b1a28e5219340c93ca0ce541335d2bdd173864bf | |
parent | b31aa2dd575e2b0ee3944d47bf2a6520dbc36320 (diff) | |
download | rails-d5e48ae7d278cb6e03bef104eac23ac5cad46c5a.tar.gz rails-d5e48ae7d278cb6e03bef104eac23ac5cad46c5a.tar.bz2 rails-d5e48ae7d278cb6e03bef104eac23ac5cad46c5a.zip |
Use the old way of getting args to the scaffold generator and un-screwup the controller name assignment appropriately.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2783 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb | 8 |
1 files changed, 3 insertions, 5 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 7ac2ac76e9..e589a9e233 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +++ b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb @@ -47,11 +47,9 @@ class ScaffoldGenerator < Rails::Generator::NamedBase def initialize(runtime_args, runtime_options = {}) super - if runtime_args.length > 1 - @controller_name = runtime_args[1] - else - @controller_name = (ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name) - end + # Take controller name from the next argument. Default to the pluralized model name. + @controller_name = args.shift + @controller_name ||= ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name 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) |