lib/reality/model/model_element.rb in reality-model-1.0.0 vs lib/reality/model/model_element.rb in reality-model-1.1.0
- old
+ new
@@ -128,10 +128,14 @@
code += <<-RUBY
public
+ def <=>(other)
+ self.#{self.id_method} <=> other.#{self.id_method}
+ end
+
def options=(options)
options.each_pair do |k, v|
keys = k.to_s.split('.')
target = self
keys[0, keys.length - 1].each do |target_accessor_key|
@@ -176,9 +180,13 @@
#{child.inverse_access_method}
end
def #{child.access_method}
#{child.inverse_access_method}_map.values
+ end
+
+ def #{child.inverse_access_method}_#{Reality::Naming.pluralize(child.id_method)}
+ #{child.inverse_access_method}_map.keys
end
def #{child.access_method}?
!#{child.inverse_access_method}_map.empty?
end