small medium large xlarge

Generic-user-small
22 Apr 2009, 13:13
Kedar Mhaswade (21 posts)

I read the naming conventions rails adopts at page 264 and was wondering if it misses the conventions about view folders. For example, look at the following two instances of script/generate: # script/generate scaffold product title:string # script/generate controller store index

The view folder for the product is in app/views/products/, whereas the view folder for store is in app/views/store. I am sure there is internal wiring to choose the view template for a controller, but I was not sure how the ambiguity was resolved.

(This is in-line with a n00b’s confusion with naming conventions as said in the book, so apologies if this is all too straightforward).

-Kedar

Samr_small_pragsmall
22 Apr 2009, 20:57
Sam Ruby (634 posts)

What you are seeing is a little bit of history. Essentially #1 is “new style”, and #2 is either “old school” or “underlying plumbing”, depending on your point of view. What I mean by that is that prior to Rails 1.2, #2 was the only option, and while you can do what you want with #2, #1 is more consistent with the conventions that Rails encourages.

This is touched on a bit more in chapter 21 (in particular, the section on Resource-Based Routing that starts on page 437).

You must be logged in to comment