Ruby on Rails
CodingStandards (Version #474)

For a decent list of general ruby code standards, please see: rubygarden:RubyStyleGuide

Conventions used in Rails

Method parameters

Only omit parentheses when the first parameter is a string or symbol and there’s no trailing condition, like unless.

some_method "a string"
some_method :symbol
some_method :symbol, :foo => 'bar'
some_method("a string") || true
some_method(an_object)

Blocks

Single statement blocks should be defined using braces.

log(sql, name, @connection) { |connection| connection.query(sql) }

Multiple statement blocks should be defined using do…end with the
variable in the block defined on the same line as the do

some_method do |i|
   puts "a string"
   puts "another string"
end

For a decent list of general ruby code standards, please see: rubygarden:RubyStyleGuide

Conventions used in Rails

Method parameters

Only omit parentheses when the first parameter is a string or symbol and there’s no trailing condition, like unless.

some_method "a string"
some_method :symbol
some_method :symbol, :foo => 'bar'
some_method("a string") || true
some_method(an_object)

Blocks

Single statement blocks should be defined using braces.

log(sql, name, @connection) { |connection| connection.query(sql) }

Multiple statement blocks should be defined using do…end with the
variable in the block defined on the same line as the do

some_method do |i|
   puts "a string"
   puts "another string"
end