Method: Spider::Model.sort
- Defined in:
- lib/spiderfw/model/model.rb
.sort(models, options = {}) ⇒ Array
Sorts an Array of models, placing subclasses before superclasses.
If :association_dependencies is true, models having an association to another model will be placed after the associated model.
This can be used to insert a dump of data, ensuring later models only depend on already inserted objects.
375 376 377 378 379 380 381 |
# File 'lib/spiderfw/model/model.rb', line 375 def self.sort(models, ={}) = { :association_dependencies => true }.merge() sorter = Sorter.new(models, ) sorter.sort end |