Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good example of written Rails coding standards?

I'm in the process of developing written code standards for a Rails app and am looking for some good examples of coding standards developed by others. Something that expands a bit on the ideas discussed in...

Does anyone have a good reference to share?

http://www.scribd.com/doc/2889649/Rails-coding-standards-defined

Examples:

  1. STYLE: Line up hash arrows for readability
  2. STYLE: put spaces around => hash arrows
  3. STYLE: put spaces after ',' in method params - but none between method names and '('

(Note that I'm new to StackOverflow and not sure if this counts as a "question"...please advise if not...)

like image 678
Kevin Dewalt Avatar asked Jun 08 '09 23:06

Kevin Dewalt


People also ask

What is the best practice for Ruby on Rails?

Ruby on Rails Best Practice: Keep Your Code DRY Ruby on Rails' object-oriented principles are built to help you avoid duplicating code throughout your web application. Whenever possible, a great Ruby on Rails tip is to re-use as much code as possible instead of repeating similar code in many places.

Why coding standards are needed?

Coding standards help in the development of software programs that are less complex and thereby reduce the errors. If programming standards in software engineering are followed, the code is consistent and can be easily maintained. This is because anyone can understand it and can modify it at any point in time.


1 Answers

Here's a style guide I rather like, Ruby-focused but definitely of the "Rails generation" of Rubyists:

Elements of Ruby Style

Credit for which belongs to Pathfinder Development:

pathfinder development logo
(source: pathf.com)

UPDATE. Two years later, I have found a better guide, brought to you by the copycopter project

like image 147
austinfromboston Avatar answered Sep 17 '22 14:09

austinfromboston