diff options
author | Kuldeep Aggarwal <kd.engineer@yahoo.co.in> | 2014-03-25 20:27:37 +0530 |
---|---|---|
committer | Kuldeep Aggarwal <kd.engineer@yahoo.co.in> | 2014-03-25 20:27:37 +0530 |
commit | 5a3817cb16e526a7b18699a6dcdafe40c42c1ddf (patch) | |
tree | b22a9daaeb6b054d109f45da87b8a245c967b629 /railties/lib/rails | |
parent | 3fd15f484c2e0ddd8e4142d8c644767320920146 (diff) | |
download | rails-5a3817cb16e526a7b18699a6dcdafe40c42c1ddf.tar.gz rails-5a3817cb16e526a7b18699a6dcdafe40c42c1ddf.tar.bz2 rails-5a3817cb16e526a7b18699a6dcdafe40c42c1ddf.zip |
Fix Generation of proper migration when
ActiveRecord::Base.pluralize_table_names = false.
Previously, generation a migration like this:
rails g migration add_column_name_to_user name
would not generating the correct table name.
Fixes #13426.
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/generated_attribute.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/generated_attribute.rb b/railties/lib/rails/generators/generated_attribute.rb index 5e2784c4b0..c5326d70d1 100644 --- a/railties/lib/rails/generators/generated_attribute.rb +++ b/railties/lib/rails/generators/generated_attribute.rb @@ -94,6 +94,10 @@ module Rails name.sub(/_id$/, '').pluralize end + def singular_name + name.sub(/_id$/, '').singularize + end + def human_name name.humanize end |