This project is archived and is in readonly mode.

#6686 new
Michael McGrath

Using scope causes models not to respect non-pluralization

Reported by Michael McGrath | April 8th, 2011 @ 02:30 PM

My first ticket so forgive errors please.

In config/environment.rb we have

ActiveRecord::Base.pluralize_table_names = false

Which works flawlessly until we add a named scope to a model such as:

class Disease < ActiveRecord::Base
  scope :active, where(:active=>true)
...

Without the scope, the model/DB interaction works perfectly. However, adding the scope line causes ActiveRecord to pluralize the table name.

Overriding with

set_table_name 'disease'

gets it working again but shouldn't be necessary.

Thanks
Michael.

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages