This file contains 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 Enumerable | |
def collect_if | |
collect { |e| yield e }.reject &:nil | |
end | |
end |
This file contains 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
class Component < ActiveRecord::Base | |
belongs_to :cabinet | |
belongs_to :component_model | |
has_many :port, :as => :device, :extend => CreatePortFromModel | |
has_many :sub_components | |
def elevation | |
orientation + elevation_index.to_s | |
end |
This file contains 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
class Component < ActiveRecord::Base | |
has_many :sub_components | |
#this is the 'other side' of the has_many :components statement | |
belongs_to :component | |
has_one :component | |
end |