Blind Fish
Blind Fish

Reputation: 998

Q about Ruby on Rails Naming Conventions

Quick question. I am an experienced developer but very new to Ruby on Rails. I am wondering how strictly one must follow the naming conventions. For instance, I am in the habit of using camel case for table names and lower case for all but the last letter of column names. It's just a habit that I have had for years and one with which I am very comfortable. I absolutely despise the practice of using an underscore to connect two words as is prescribed for instance variables in Ruby. What I am wondering is, will there be any problems if my models are in camel case and my instance variables are all lower case save for the last letter? I've seen some docs that say it could change the way the interpreter interacts with my models. I've seen other docs that say it's no big deal. How does all of this come into play in regards to scaffolding?

Upvotes: 0

Views: 229

Answers (1)

lurker
lurker

Reputation: 58324

I believe some aspects of Rails will let you do what you wish (e.g., you can have an attribute start with an upper case letter rather than the generally assumed lower case), but it will be a lot more work for you if you deviate from their conventions. A lot of Rails framework functionality assumes the Rails convention and you might lose the ability to use some of those facilities. And then there are some I'm not sure there's a way to work around, like the naming of a file for a model (client_info.rb) versus the class inside (ClientInfo). Those are assumed to align.

My recommendation would be to learn the Rails way unless you want to live in your own Rails convention world, isolated from the rest of the Rails world. It bugged me too, at first, but I got used to it pretty quickly. :)

Upvotes: 2

Related Questions