I want to annotate a specific model not all.
Can i pass a model name or table name with annotate_model 开发者_开发技巧rake task to annotate specific model ?
Modify vendor/plugins/annotate_models/lib/annotate_models.rb
replace
def self.do_annotations
with
def self.do_annotations(model_names=nil)
replace
model_names = model_names.split(',') unless model_names.nil?
model_names = model_names.nil? ? self.get_model_names : model_names
model_names.each do |m|
with
self.get_model_names.each do |m|
Modify libs/annotate_models_tasks.rake
replace
AnnotateModels.do_annotations
with
AnnotateModels.do_annotations ENV['MODEL_NAMES']
Now you can pass parameter to the rake task..
Example:
rake annotate_models MODEL_NAMES=csv_header,csv_columne
pass filenames without .rb in parameter.
May be that will help ...
精彩评论