Skip to content

Instantly share code, notes, and snippets.

@gumayunov
Last active December 11, 2015 03:19
Show Gist options
  • Save gumayunov/4536589 to your computer and use it in GitHub Desktop.
Save gumayunov/4536589 to your computer and use it in GitHub Desktop.
class Name < AcriveRecord::Base
# includes & extensions
include Module
# constants
CONST = 1
# attributes
attr_accessor :attribute
# mass-asignment constraints
attr_accessible :name, :email
# associations
has_many :items
# callbacks
after_save :callback
# scopes
scope :before, lambda { |time| where("created_at < ?", time) }
# class methods
class << self
def foo
end
end
# instance methods
def bar
end
# privates
private
def baz
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment