Skip to content

Instantly share code, notes, and snippets.

@cokron
Created March 19, 2012 18:05
Show Gist options
  • Save cokron/2122027 to your computer and use it in GitHub Desktop.
Save cokron/2122027 to your computer and use it in GitHub Desktop.
Ruby style guides
# This class holds the logic for X
class Foo
extend SomeModule
include SomeModule
# associations
has_many :bars
# scopes
named_scope :special_foos
# validations
validates_presence_of :name
# callbacks
reader/writer
delegates
class <<self
def some_class_method
# do stuff
end
end
def initialize
end
def some_instance_method
# do stuff
end
private
def some_private_method
# do stuff
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment