Method: AnnotateModels.do_annotations
- Defined in:
- lib/annotate/annotate_models.rb
.do_annotations(options = {}) ⇒ Object
We’re passed a name of things that might be ActiveRecord models. If we can find the class, and if its a subclass of ActiveRecord::Base, then pass it to the associated block
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 |
# File 'lib/annotate/annotate_models.rb', line 647 def do_annotations( = {}) () header = [:format_markdown] ? PREFIX_MD.dup : PREFIX.dup version = ActiveRecord::Migrator.current_version rescue 0 if [:include_version] && version > 0 header << "\n# Schema version: #{version}" end annotated = [] get_model_files().each do |path, filename| annotate_model_file(annotated, File.join(path, filename), header, ) end if annotated.empty? puts 'Model files unchanged.' else puts "Annotated (#{annotated.length}): #{annotated.join(', ')}" end end |