Forum: Ruby on Rails Confused with naming conventions...

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.
Fdb488647484e40f785dde7134afc6d1?d=identicon&s=25 Heinz Strunk (cojones)
on 2008-12-21 18:15
Hey,

I'm currently reading "Agile Web Development" and doing the tutorial
(Depot). It says that the naming conventions are that the Controller
needs to be singular (even though I found other naming conventions on
the net, anybody knows the official naming conventions?) therefore I
have a UserController. When I try to test the controller I get this
error:
NameError: uninitialized constant UsersController
right here:
assert_redirected_to user_path

Why does it want a UsersController? I thought singular is the way to go?
Confused.
C4cd024191ff30fb901592e63d9ef820?d=identicon&s=25 DAZ (Guest)
on 2008-12-21 20:51
(Received via mailing list)
I think it is models are singular
eg
User model

...and controllers are plural:
users controller

Are you sure you read it right?

DAZ

On Dec 21, 5:15 pm, Heinz Strunk <rails-mailing-l...@andreas-s.net>
Fdb488647484e40f785dde7134afc6d1?d=identicon&s=25 Heinz Strunk (cojones)
on 2008-12-22 03:06
DAZ wrote:
> I think it is models are singular
> eg
> User model
>
> ...and controllers are plural:
> users controller
>
> Are you sure you read it right?
>
> DAZ
>
> On Dec 21, 5:15�pm, Heinz Strunk <rails-mailing-l...@andreas-s.net>

Yep, pretty sure:
"Rails assumes the class is called StoreController and that it’s in a
file
named store_controller.rb in the app/controllers directory."

So 100% plural?
9a2a53db8e9b4476038c94a64b32833f?d=identicon&s=25 Ryan Bigg (ryan-bigg)
on 2008-12-22 03:13
(Received via mailing list)
Some resources you'll want singular controllers for, like session
management. Others you'll want plural controllers for, like forums,
topics, posts and users. Think about how many items you're dealing
with at a time and then let that dictate how your controllers are named.
-----
Ryan Bigg
Freelancer
http://frozenplague.net
Dd2d775dea75b381edb1bbf0600a0907?d=identicon&s=25 Marnen Laibow-Koser (marnen)
on 2008-12-22 04:29
(Received via mailing list)
On Dec 21, 12:15 pm, Heinz Strunk <rails-mailing-l...@andreas-s.net>
wrote:
> Hey,
>
> I'm currently reading "Agile Web Development" and doing the tutorial
> (Depot). It says that the naming conventions are that the Controller
> needs to be singular
[...]

Controller names should generally be plural in Rails 2; see
http://giantrobots.thoughtbot.com/2008/1/8/rails-2... .

Best,
--
Marnen Laibow-Koser
marnen@marnen.org
http://www.marnen.org
Fdb488647484e40f785dde7134afc6d1?d=identicon&s=25 Heinz Strunk (cojones)
on 2008-12-22 10:22
Alright, thanks guys! A lot of editing is waiting for me now...
This topic is locked and can not be replied to.