Hey, I'm currently reading "Agile Web D." 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.
on 2008-12-21 19:15
on 2008-12-21 21:51
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 S. <email@example.com>
on 2008-12-22 04: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 S. <firstname.lastname@example.org> 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?
on 2008-12-22 04:13
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 B. Freelancer http://frozenplague.net
on 2008-12-22 05:29
On Dec 21, 12:15 pm, Heinz S. <email@example.com> wrote: > Hey, > > I'm currently reading "Agile Web D." 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 firstname.lastname@example.org http://www.marnen.org
on 2008-12-22 11:22
Alright, thanks guys! A lot of editing is waiting for me now...