module ITGlue::Asset::Relatable
Public Instance Methods
children(*child_types)
click to toggle source
# File lib/itglue/asset/base/relatable.rb, line 14 def children(*child_types) child_types.each do |child_type| define_method child_type do |options = {}| "ITGlue::#{child_type.to_s.classify}".constantize.get_nested(self, options) end end end
parent(parent_type, options = {})
click to toggle source
# File lib/itglue/asset/base/relatable.rb, line 4 def parent(parent_type, options = {}) @parent_type = parent_type.to_s.pluralize unless options[:no_association] define_method parent_type do parent_id = self.send("#{parent_type}_id") "ITGlue::#{parent_type.to_s.classify}".constantize.find(parent_id) end end end
Protected Instance Methods
nested_asset()
click to toggle source
# File lib/itglue/asset/base/relatable.rb, line 24 def nested_asset @nested_asset = true end
nested_asset?()
click to toggle source
# File lib/itglue/asset/base/relatable.rb, line 28 def nested_asset? !!@nested_asset end
parent_type()
click to toggle source
# File lib/itglue/asset/base/relatable.rb, line 32 def parent_type @parent_type end