diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails_generator/base.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/railties/lib/rails_generator/base.rb b/railties/lib/rails_generator/base.rb index f7aa2169ca..6a56f96b1c 100644 --- a/railties/lib/rails_generator/base.rb +++ b/railties/lib/rails_generator/base.rb @@ -144,10 +144,9 @@ module Rails # # See Rails::Generator::Base for a discussion of Manifests and Commands. class NamedBase < Base - attr_reader :name, :class_name, :singular_name, :plural_name + attr_reader :name, :class_name, :singular_name, :plural_name, :table_name attr_reader :class_path, :file_path, :class_nesting, :class_nesting_depth alias_method :file_name, :singular_name - alias_method :table_name, :plural_name alias_method :actions, :args def initialize(runtime_args, runtime_options = {}) @@ -172,6 +171,7 @@ module Rails @name = name base_name, @class_path, @file_path, @class_nesting, @class_nesting_depth = extract_modules(@name) @class_name_without_nesting, @singular_name, @plural_name = inflect_names(base_name) + @table_name = ActiveRecord::Base.pluralize_table_names ? plural_name : singular_name if @class_nesting.empty? @class_name = @class_name_without_nesting else 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 5ffe428fce..0f789efc83 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +++ b/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb @@ -46,7 +46,7 @@ class ScaffoldGenerator < Rails::Generator::NamedBase def initialize(runtime_args, runtime_options = {}) super - @controller_name = args.shift || @name.pluralize + @controller_name = args.shift || 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) if @controller_class_nesting.empty? |