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

Ticket #10615 (closed defect: fixed)

Opened 2 years ago

Last modified 1 year ago

[PATCH] #classify inflector does not correctly document assumption that table name is plural

Reported by: kennycarruthers Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveSupport Version: edge
Severity: normal Keywords: docs, verified
Cc:

Description

If you call classify() on the string "Business", it returns the string "Busines", and not the string "Business" as expected.

"Business".classify

=> "Busines"

Expected behavior is that the string "Business" is returned. This is in Rails 2.0.2.

Attachments

inflector_classify_documentation_patch.diff (2.0 kB) - added by kris_chambers on 01/07/08 00:36:07.

Change History

12/26/07 10:28:57 changed by evolving_jerk

This is because .singularize call on 'Business' returns 'Busines'. Now looking for the cure.

12/26/07 14:40:07 changed by technoweenie

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

use #camelize if you don't want #singularize called.

12/26/07 14:47:06 changed by evolving_jerk

  • status changed from closed to reopened.
  • resolution deleted.

Rick,

I have to disagree and reopen. Why classify users should care about what's going on inside and how to work around odd things? Is it by design of things here? What's the idea of it then?

12/26/07 15:55:51 changed by matt

  • status changed from reopened to closed.
  • resolution set to untested.

@evolving_jerk this ticket will be closed until someone writes some tests.

12/26/07 16:10:10 changed by hasmanyjosh

  • keywords set to docs.
  • status changed from closed to reopened.
  • resolution deleted.
  • summary changed from "Business".classify returns "Busines" and not "Business" (Note missing 's') to #classify inflector does not correctly document assumption that table name is plural.

Note that #classify is meant to convert the name of a table to the name of a class, so it assumes its receiver is a plural form table name. However, the documentation isn't very clear on just what it does, and that it can't tell if a table name is singular or plural. In fact the use of the "post" example is misleading, and the docs should be fixed. I'm going to reopen this as a doc defect.

01/07/08 00:36:07 changed by kris_chambers

  • attachment inflector_classify_documentation_patch.diff added.

01/07/08 00:39:24 changed by kris_chambers

  • summary changed from #classify inflector does not correctly document assumption that table name is plural to [PATCH] #classify inflector does not correctly document assumption that table name is plural.

01/07/08 01:03:37 changed by hasmanyjosh

+1

thanks!

01/07/08 01:13:48 changed by matt

+1

01/07/08 03:43:11 changed by jqr

+1

01/07/08 04:30:03 changed by hasmanyjosh

  • keywords changed from docs to docs, verified.

01/08/08 21:20:09 changed by nzkoz

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [8599]) Merge classify documentation. Closes #10615 [kris_chambers]