This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HasRelations | |
module ClassMethods | |
def has_relations | |
include InstanceMethods | |
has_many :relations, :as => :from | |
end | |
end | |
module InstanceMethods | |
def related(relation_type = nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HasRelations | |
module ClassMethods | |
def has_relations | |
include InstanceMethods | |
has_many :relations, :as => :from | |
end | |
end | |
module InstanceMethods | |
def related(relation_type = nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RelationExtensions | |
extend ActiveSupport::Concern | |
included do | |
# -- Constants ------------------------------------------------------------ | |
# -- Attributes ----------------------------------------------------------- | |
attr_accessor :relation_identifier, :relation_position | |
# -- AR Extensions -------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// String literal, string primitive | |
// This is not an object | |
// This doesn't have any of its own functions | |
var schoolName = "General Assembly" | |
// When I call this, it temporarily makes a String Object around it. | |
// Slower. I'll talk about why in a second | |
var upperCaseSchoolName = schoolName.toUpperCase | |
/* |