Forum: Ruby on Rails rails pluralizing when not supposed to ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-02-05 07:18
(Received via mailing list)
lo there all.

i am having a strange problem with generating a scaffold.
everything is pluralized.

for example, if i do a script/generate scaffold Admin ( the example in
my book )
instead of admin_controller.rb i get admins_controller.rb
instead of /app/views/admin i get /app/views/admins

is there a configuration setting that i am missing ?

thanks
B5feafb2c66fdff60029deda63f99f93?d=identicon&s=25 dweinand (Guest)
on 2007-02-05 08:31
(Received via mailing list)
pluralization is by design.
try this in your environment.rb do disable pluralization if you need.

ActiveRecord::Base.pluralize_table_names = false

HTH
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-02-05 14:28
(Received via mailing list)
On Feb 5, 1:30 am, "dweinand" <mail...@googlemail.com> wrote:
> pluralization is by design.
> try this in your environment.rb do disable pluralization if you need.
>
> ActiveRecord::Base.pluralize_table_names = false
>
> HTH


ok, well, is this something i should do ? should i go with the table
names pluralized instead of not.
I mean, if pluralization is by design, should i change that ?

thanks
sk
81f1ef9f260d20fbb4ff60b3a2a6f541?d=identicon&s=25 Peter (Guest)
on 2007-02-05 17:19
Hi,

Just go with the flow.
If its a new app and you are in control.
Who cares if my table is called 'vehicle' or 'vehicles'.
Check out migrations.
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-02-05 17:23
Peter wrote:
> Hi,
>
> Just go with the flow.
> If its a new app and you are in control.
> Who cares if my table is called 'vehicle' or 'vehicles'.
> Check out migrations.

ok, now my table names are plural,
i have users, groups, stations, etc..
so when the scaffold is generated i should have plural controllers ?
like users_controller.rb ?
and /app/views/users/ and so on. this is all ok?
if so, great, i will not sweat it any more.

thanks for your help
391f7ae8dd8c10dc323b7fbfe55b71a2?d=identicon&s=25 monki (Guest)
on 2007-02-05 21:49
(Received via mailing list)
Controllers and paths should be the plural of the model name,
so you should be on the right track now.

On Feb 5, 10:23 am, Shawn Bright <rails-mailing-l...@andreas-s.net>
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-02-05 22:09
(Received via mailing list)
On Feb 5, 2:48 pm, "monki" <gee...@gmail.com> wrote:
> > > If its a new app and you are in control.
> > thanks for your help
>
> > --
> > Posted viahttp://www.ruby-forum.com/.


way cool, thanks

shawn
This topic is locked and can not be replied to.