Pluralization or something else

I have a table speech_databases, and successifully generated scaffolding
code for it (controller, model, views).

But, when I try to start my controller
(http://localhost:3000/speech_databases) I got:


NameError in Speech databasesController#index
uninitialized constant SpeechDatabasis

This error occured while loading the following files:
speech_databasis.rb

It seems to me like it is trying to load model from SpeechDatabasis
class, but I don’t have that file. All I’ve generated is

speech_database.rb:

class SpeechDatabase < ActiveRecord::Base
belongs_to :group
has_and_belongs_to_many :users
end

Igor M. wrote:

It seems to me like it is trying to load model from SpeechDatabasis
class, but I don’t have that file. All I’ve generated is

I found the solution.

In method paginate, I added option

:singular => “speech_database”

But I am still confused why it didn’t worked without this option added?

Humm…

singularize beleives that the singular form of “databases” is
“databasis”

“Databases”.singularize
=> “Databasis”

Without having tried this in a real rails app. You should be able to
add those lines into config/environment.rb

Inflector.inflections do |inflect|
inflect.plural(/(database)$/i, ‘\1s’)
inflect.singular(/(database)s$/i, ‘\1’)
end

It at least worked to add this inside script/console.

On 8/23/06, Igor M. [email protected] wrote:


Jon Gretar B.
http://www.jongretar.net/