Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

annotates object daddy exemplar files

  • Loading branch information...
commit b55ed4c92faa15fd3ee7ed385b16ba8a758357f4 1 parent ec66757
@nofxx nofxx authored
Showing with 18 additions and 15 deletions.
  1. +16 −15 README.txt
  2. +2 −0  lib/annotate_models.rb
View
31 README.txt
@@ -3,20 +3,21 @@
( |/)/)()/(//(- / |()(/(-(_)
________________________________
-Add a comment summarizing the current schema to the bottom of each
-ActiveRecord model, Test File, Fixture and Factory source file:
-
- # == Schema Info
- # Schema version: 20081001061831
- #
- # Table name: line_item
- #
- # id :integer(11) not null, primary key
- # quantity :integer(11) not null
- # product_id :integer(11) not null
- # unit_price :float
- # order_id :integer(11)
- #
+Add a comment summarizing the current schema to the
+bottom of each ActiveRecord model, Test File,
+Exemplar, Fixture and Factory source file:
+
+ # == Schema Info
+ # Schema version: 20081001061831
+ #
+ # Table name: line_item
+ #
+ # id :integer(11) not null, primary key
+ # quantity :integer(11) not null
+ # product_id :integer(11) not null
+ # unit_price :float
+ # order_id :integer(11)
+ #
class LineItem < ActiveRecord::Base
belongs_to :product
@@ -26,7 +27,7 @@ Note that this code will blow away the initial/final comment block in your model
if it looks like it was previously added by annotate models, so you don't want to
add additional text to an automatically created comment block.
- = = Back up your model files before using... = =
+ * * Back up your model files before using... * *
== HOW TO USE:
View
2  lib/annotate_models.rb
@@ -6,6 +6,7 @@
FIXTURES_DIR = File.join(RAILS_ROOT, "test/fixtures")
SPEC_FIXTURES_DIR = File.join(RAILS_ROOT, "spec/fixtures")
FACTORY_FILE = File.join(RAILS_ROOT, "spec/factory.rb") || File.join(RAILS_ROOT, "test/factory.rb")
+EXEMPLARS_DIR = File.join(RAILS_ROOT, "spec/exemplars")
SORT_COLUMNS = ENV['SORT'] ? ENV['SORT'] != 'no' : true
module AnnotateModels
@@ -99,6 +100,7 @@ def self.annotate(klass, header)
File.join(FIXTURES_DIR, fixtures_name), # fixture
File.join(SPEC_MODEL_DIR, "#{model_name}_spec.rb"), # spec
File.join(SPEC_FIXTURES_DIR, fixtures_name), # spec fixture
+ File.join(EXEMPLARS_DIR, "#{model_name}_exemplar.rb"),
].each { |file| annotate_one_file(file, info) }
end
Please sign in to comment.
Something went wrong with that request. Please try again.