[前][次][番号順一覧][スレッド一覧]

rails:247

From: take_tk <ggb03124@n...>
Date: Tue, 12 Jul 2005 12:19:06 +0900
Subject: [rails:247] pluralize_table_names=false が効かない。

たけ(tk)です

----
[Rails] Table called 'lens', won't work.... Sat, 09 Jul 2005 18:21:12
-0600
First off, I name my database tables for the type of object that they 
contains, which implies no pluralization.  I have a database table 
called 'Lens', for camera lenses.  When I execute this command:

    script/generate scaffold Lens

followed by a fetch to:

    http://localhost:2000/lens

I get this error:

    uninitialized constant Len
・・・
There is no 'len.rb' file.  I also have this statement in my environment.rb:

    ActiveRecord::Base.pluralize_table_names = false

But this doesn't seem to have any effect on the generator.

I'm running rails 0.13, which was supposed to have fixed one or more 
pluralization errors, but it appears that this particular table name 
still causes the error.  So, two things:

1. How do I fix this, and
2. Is there any way that pluralization can be *completely* turned off?  
While I like Rails and all the work it does for you behind the scenes, 
pluralization drives me nuts. 

Thanks!

    -klm.
----

カメラのレンズのための「lens」という名前のテーブルを作ったらエラーになり
ました。

    script/generate scaffold Lens
    #=> uninitialized constant Len

「lens」は単数形で、複数形は「lenses」なのに、Railsが「len」の複数形だと
誤解して、単数形のクラス名「Len」が無いとか、「len.rb」ファイルが無いと
かという文句を言ってくるようです。

そこで、environment.rb: に

    ActiveRecord::Base.pluralize_table_names = false

と書いたのですが、generator には効果が無いようです。

----
Re: [Rails] Table called 'lens', won't work....Mon, 11 Jul 2005 15:02:54 +1200

> I had this in environment.rb, and it had no effect, for this particular
> problem.

It won't work with the scaffolding generator.   This is a known issue
and will not be fixed till after rails 1.0.

Cheers

Koz
----

この問題は知られていますが、Rails1.0以降でも直っていません。



Take_tk = KUMAGAI Hidetake
たけ(tk)=熊谷秀武


--
ML: rails@r...
使い方: http://QuickML.com/

[前][次][番号順一覧][スレッド一覧]