Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6107 (closed defect: wontfix)

Opened 3 years ago

Last modified 2 years ago

[PATCH] Reflection class_name should respect pluralization setting

Reported by: kamal.fariz@gmail.com Assigned to: bitsweat
Priority: normal Milestone: 1.2.5
Component: ActiveRecord Version: edge
Severity: normal Keywords: tiny
Cc: kamal

Description

When working with legacy databases, it is common to turn off table pluralization, i.e.

ActiveRecord::Base.pluralize_table_names = false

Also, as a matter of convenience, I then map class names 1-to-1 to the table names, including pre-pluralized ones as well.

I found that that while SQL generation respects the no pluralization setting, reflection of has_many/has_many through class_name (#klass) does not. This patch adds ActiveRecord::Base.pluralize_table_names as an added condition before deciding to singularize the class name.

NOTE: I have verified all AR tests remain valid.

Attachments

reflection_should_respect_pluralization_setting.patch (3.9 kB) - added by kamal.fariz@gmail.com on 09/08/06 08:40:40.
reflection_should_respect_pluralization_setting-r6930.patch (4.0 kB) - added by kamal on 06/04/07 07:29:56.
update patch file to patch cleanly against current edge (r6930)
reflection_should_respect_pluralization_setting.2.patch (4.1 kB) - added by tarmo on 10/08/07 06:24:24.
Rebased for current edge

Change History

09/08/06 08:40:40 changed by kamal.fariz@gmail.com

  • attachment reflection_should_respect_pluralization_setting.patch added.

06/01/07 01:16:17 changed by kamal

  • cc set to kamal.
  • owner changed from David to rick.

06/04/07 07:29:56 changed by kamal

  • attachment reflection_should_respect_pluralization_setting-r6930.patch added.

update patch file to patch cleanly against current edge (r6930)

06/04/07 07:30:23 changed by kamal

  • owner changed from rick to bitsweat.

10/08/07 06:24:24 changed by tarmo

  • attachment reflection_should_respect_pluralization_setting.2.patch added.

Rebased for current edge

10/08/07 06:36:07 changed by tarmo

  • status changed from new to closed.
  • resolution set to wontfix.

has_many/has_and_belongs_to_many macros should always be plural.