I forked AnnotateModels to fix what I'm guessing is a bug - options (including position) were not being passed when annotating spec, test, or exemplar files. This resulted in my models having annotations at the bottom of my models but at the top of my specs, which was frustrating.
Add a comment summarizing the relevant portion of the current schema to the top or bottom of your...
This version of AnnotateModels will pass all options to the method annotate_one_file when annotating models and specs (or tests, or exemplars, whatever you use). Otherwise this version is exactly the same as the original!
* ActiveRecord models
* Fixture files
* Tests and Specs
* Object Daddy exemplars
== AnnotateModels
The schema comment looks like this:
Add a comment summarizing the current schema to the bottom of each
ActiveRecord model, fixture file.
If you are using Object Daddy, it`ll annotate your example files too.
# == Schema Info
# == Schema Info
#
#
...
@@ -26,7 +24,7 @@ If you are using Object Daddy, it`ll annotate your example files too.
...
@@ -26,7 +24,7 @@ If you are using Object Daddy, it`ll annotate your example files too.
belongs_to :product
belongs_to :product
. . .
. . .
Annotates geometrical columns, geom type and srid, when using SpatialAdapter or PostgisAdapter:
It also annotates geometrical columns, geom type and srid, when using SpatialAdapter or PostgisAdapter:
# == Schema Info
# == Schema Info
#
#
...
@@ -35,6 +33,8 @@ Annotates geometrical columns, geom type and srid, when using SpatialAdapter or
...
@@ -35,6 +33,8 @@ Annotates geometrical columns, geom type and srid, when using SpatialAdapter or
# local :geometry point, 4326
# local :geometry point, 4326
# path :geometry line_string, 4326
# path :geometry line_string, 4326
Also, if you pass the -r option, it'll annotate routes.rb with the output of "rake routes".
== Warning
== Warning
Note that this code will blow away the initial/final comment
Note that this code will blow away the initial/final comment