Skip to content

Instantly share code, notes, and snippets.

@modsognir
Forked from ltw/best_model.rb
Created February 21, 2011 01:31
Show Gist options
  • Save modsognir/836527 to your computer and use it in GitHub Desktop.
Save modsognir/836527 to your computer and use it in GitHub Desktop.
class Model < ParentModel
include Foo::Bar
extend Bar::Baz
module InternalModule
...
end
default_scope :order => 'id ASC'
belongs_to :foo
has_one :baz
has_many :bars
has_many :maz, :through => :daz
has_and_belongs_to_many :jaz
...
validates_presence_of :id
validates_uniqueness_of :id
validates_inclusion_of :rating, :in => [1..10]
validates_numericality_of :taz
...
scope :by_name, :order => 'name ASC'
def self.class_method
end
def instance_method
end
protected
def self.class_method
end
def instance_method
end
private
def self.class_method
end
def instance_method
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment