Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby ActiveRecord Basics Migrations and Relationships Migrations

Shawn Wilson
seal-mask
.a{fill-rule:evenodd;}techdegree
Shawn Wilson
iOS Development Techdegree Student 7,049 Points

upper / lower case question

Hey all im currently in the Active Records module of the Ruby development track.. in the video migrations I have noticed Hampton bounces back and fourth with capitalizing names of models and such.. is there a reason for this or is this just how he prefers it.. I like to keep a naming and style convention either all lowercase (hardtoread) or camel case (hardToRead) ect.. just curious if there is anything behind it or if its just his preference.. would this be considered best practice?

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

That depends. There are some conventions that you have to get used to and learn by seeing them often. Whenever you refer to a model, you always use singular Pascal case (TodoItem). When you talk about a table or a controller, you use plural snake case (todo_items) - notice that uppercase letter in Pascal case always translates into additional underscore in snake case. When generating things like migrations and giving them names, you can use Pascal case or snake case, Rails will translate it to snake case either way. I can give you more examples, but you need to be specific :)

Shawn Wilson
seal-mask
.a{fill-rule:evenodd;}techdegree
Shawn Wilson
iOS Development Techdegree Student 7,049 Points

No that's ok I'll look more into cases in the very near future I just noticed a few anomalies and wanted to ask the question. Cheers!