Topic: Quick Reference on naming conventions in Rails

Hi Everyone,

I have put together a document that describes the naming conventions of Rails.

It started off as a reference for myself, but have enhanced it for general consumption...

From the introduction:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Quote
In Rails it is so important to get the naming conventions correct.  Particularly at the  beginning of a new project.  Grasping this logic will go a long way to gaining a full understanding of Rails .  If you get it wrong, things can get ugly.

This document describes the naming conventions Ruby on Rails uses in regard to the models, controllers, source files, classes, table names, relationships, methods & the corresponding folder structures.  These are created via the 'ruby script/' command line generator.

This is aimed at beginners & I hope folk find it useful.
<<<<<<<<<<<<<<< End Quote

It can be found here:
http://www.daveporter.info/ror/ror_naming.pdf

This is a first draft, so I would appreciate any feedback on accuracy and usefulness...

Regards, Dave Porter

Re: Quick Reference on naming conventions in Rails

Thanks smile for the effort !!
CAn you post some basics about the RESTful stuff in RAils 2.0

Re: Quick Reference on naming conventions in Rails

Hi CrazyR,

At this stage no, but I'm sure you will find plenty of other references....

I'm currently working through the new 3rd Edition of 'Agile Web Development with Rails' and also the Sitepoint Rails book ( the newer v2 one ).  They are probably good candidates..

cheers, Dave

Re: Quick Reference on naming conventions in Rails

Hi Everyone,

This PDF document has been updated:

1) Added section on routes.
2) Corrected a couple of errors.
3) Improved readability.

http://www.daveporter.info/ror/ror_naming.pdf

Once again - I would appreciate any feedback on accuracy and usefulness...

Regards, Dave Porter

Re: Quick Reference on naming conventions in Rails

Thanks Dave, it was very useful for me.

One small question I have:
What about the capitals? Up till now, I would have typed "script/generate model category" instead of "script/generate model Category" , same for controller , ...

Does this make a difference? When looking through my files, it seems like RoR automatically changes this? I also created a "project_category" scaffold, and it seems like RoR automatically changed this to "ProjectCategory" in some places? But the file names still have the underscore?

Is CamelCase automatically used in the files and the underscore in the file names?

Thanks! And thanks for the document!

Re: Quick Reference on naming conventions in Rails

Yes it is. You can write everything in downcase.