Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best annotation position is different for models and fixtures... #6

Closed
adamsalter opened this issue Sep 25, 2009 · 6 comments
Closed
Labels

Comments

@adamsalter
Copy link

The 'best' IMHO position for annotations in models is after all code, since you regularly have to edit it and only refer to annotations irregularly. But for fixtures it's is before all the yaml data, since you can have huge yaml files and scrolling to the bottom is annoying/hard, and use usually only refer to fixtures once or twice in their lifetime (certainly less than models).

Could this be changed to the default behaviour? (I know it makes the current 'before|after' syntax a little hard since it is a mix of both...

Thanks in advance,

@ctran
Copy link
Owner

ctran commented Sep 25, 2009

I'll see what I can do.

@adamsalter
Copy link
Author

Great!
Thanks for the quick reply ;)

@jlw
Copy link

jlw commented Nov 12, 2009

I've used Dave Thomas' annotate models plugin since at least mid-07 and just found your fork (I have other devs who never bother to run annotations, so the after migrate hook is my reason for changing). IMHO, having the default change for everyone to after the model class based on 1 person's preference is bad form.

  1. Please change annotate_one_file to:

new_content = options[:position] == 'after' ? (old_content + "\n" + info_block) : (info_block + old_content)

  1. Or at the very least fix the bug in the annotate_models rake task - :before should be 'before' (:before != 'before').

@kuroda
Copy link
Contributor

kuroda commented May 14, 2010

+1 for jlw

Please fix the subtle bug that he mentioned.

Line 5 and 6 must be end with 'before' instead of :before.

Because of this bug, the annotation is inserted after the code without -p option.

@davidxia
Copy link
Contributor

IMHO, annotations at the beginning of the model file seems to be more widely practiced. I agree with @jlw. Can we make 'before' the default option? I've made both of @jlw suggestions above into a pull request here #69

This issue is related to #34. @robertwahler converts options[:position] to a symbol in annotate_models.rb so that's another way.

@ctran
Copy link
Owner

ctran commented Feb 26, 2014

It's is now possible to have your own config. Please check the documentation.

@ctran ctran closed this as completed Feb 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants