ctran / annotate_models Goto Github PK
View Code? Open in Web Editor NEWAnnotate Rails classes with schema and routes info
License: Other
Annotate Rails classes with schema and routes info
License: Other
When I run annotate I get this error:
$ annotate
DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead. (called from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@lemonfrog/gems/activesupport-2.3.8/lib/activesupport.rb:2)
default config
** Erubis 2.6.5
/Users/pupeno/.rvm/gems/ruby-1.8.7-p174@lemonfrog/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require': no such file to load -- annotate/annotate_models (MissingSourceFile)
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@lemonfrog/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@lemonfrog/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@lemonfrog/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@lemonfrog/gems/annotate-2.4.0/lib/tasks/annotate_models.rake:3
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@global/gems/rake-0.8.7/lib/rake.rb:636:in `call'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@global/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@global/gems/rake-0.8.7/lib/rake.rb:631:in `each'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@global/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@global/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
from /Users/pupeno/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@global/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@global/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@lemonfrog/gems/annotate-2.4.0/bin/annotate:67
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@lemonfrog/bin/annotate:19:in `load'
from /Users/pupeno/.rvm/gems/ruby-1.8.7-p174@lemonfrog/bin/annotate:19
This is at least in Rails 3.1, I don't know elsewhere.
$ rake db:annotate --trace
rake aborted!
Don't know how to build task 'db:annotate'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task_manager.rb:49:in `[]'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:111:in `invoke_task'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/usr/local/Cellar/ruby/1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19:in `<main>'
unusable currently with Rails 3.1.1
rubyrails:atelier (ruby-1.9.2@rails311)$ annotate
/Users/yves/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/rake.rb:2482:in const_missing': uninitialized constant Rake::DSL (NameError) from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/bin/annotate:11:in
<class:TaskLib>': uninitialized constant Rake::DSL (NameError) from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in
module:Rake'<top (required)>' from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/gems/rake-0.9.2/lib/rake/testtask.rb:4:in
<top (required)>'<top (required)>' from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/gems/railties-3.1.1/lib/rails/test_unit/railtie.rb:12:in
block in class:TestUnitRailtie'call' from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/gems/railties-3.1.1/lib/rails/railtie.rb:183:in
block in load_tasks'each' from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/gems/railties-3.1.1/lib/rails/railtie.rb:183:in
load_tasks'block in load_tasks' from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/gems/railties-3.1.1/lib/rails/application/railties.rb:8:in
each'all' from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/gems/railties-3.1.1/lib/rails/engine.rb:396:in
load_tasks'load_tasks' from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in
method_missing'<top (required)>' from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/gems/annotate-2.4.1.beta1/lib/annotate.rb:20:in
load'load_tasks' from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/gems/annotate-2.4.1.beta1/bin/annotate:66:in
<top (required)>'load' from /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails311/bin/annotate:21:in
'Hi everyone :)
Annotate has a strange behavior on Windows. I managed to install it, I added it to my gemfile, did the bundle install and so... I can launch the command "annotate" but then... nothing happens.
No matter how long I wait nothing come out.
I'm using Rails 3.0.9, mysql2 version 0.2.7 and the very last version of annotate (2.4.0).
Does anyone one have the same issue and came with a solution ?
Thanks to all the good soul who'll try to help me :)
Kulgar.
Hi,
I was searching the annotation for a route, and I could not find it, as it happens, it is the first route, so, I went into the code and had a look, and it's dropping the first lines returned by rake routes, which in my case (rails 3.1) is not a file path but the first route.
Can someone else verify this ?
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment
| city | int(11) | NULL | YES | | NULL | | select,insert,update,references | species and city mainly used in search form |
column city with a comment ,but its annotate is not contain it
maybe the Rails did not extract the comment data
Hi,
Any way you could add support for https://github.com/matthuhiggins/foreigner/ so that the foreign keys would show up in the annotations ?
Regards,
It seems annotate will add a blank line before the comment on each run, incrementing the amount of blank lines between the end that closes the model and the # == Schema information comment.
When I try to annotate It doesnt work.
The error says namespace, but I believe it is not related with routes.
/Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activerecord-3.1.0.rc4/lib/active_record/railties/databases.rake:3:in <top (required)>': undefined method
namespace' for main:Object (NoMethodError)
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in load' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in
block in load'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in block in load_dependency' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in
new_constants_in'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in load_dependency' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in
load'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activerecord-3.1.0.rc4/lib/active_record/railtie.rb:26:in block in <class:Railtie>' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in
call'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in block in load_tasks' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in
each'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in load_tasks' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/application.rb:103:in
block in load_tasks'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/application/railties.rb:8:in each' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/application/railties.rb:8:in
all'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/application.rb:103:in load_tasks' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/railtie/configurable.rb:30:in
method_missing'
from Rakefile:7:in <top (required)>' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/annotate-2.4.0/lib/annotate.rb:17:in
load'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/annotate-2.4.0/lib/annotate.rb:17:in load_tasks' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/annotate-2.4.0/bin/annotate:66:in
<top (required)>'
from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/bin/annotate:19:in load' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/bin/annotate:19:in
Revamp the testing framework with RSpec 2 and SimpleCov.
Out of the box, annotate_models was annotating at the bottom of my files. It seems the rake file sets the default to a symbol. This commit uses a symbol rather than a string to fix the issue for me:
% svn st; annotate; annotate -d; svn st
Curb not found. Using Net::HTTP.
Annotated (9): Account, Answer, Business, Favorite, Friendship, Invitation, Question, Service, User
Curb not found. Using Net::HTTP.
Removed annotation from: Account, Answer, Business, Favorite, Friendship, Invitation, Question, Service, User
M test/unit/user_test.rb
M test/unit/favorite_test.rb
M test/unit/answer_test.rb
M test/unit/service_test.rb
M test/unit/invitation_test.rb
M test/unit/question_test.rb
M test/unit/business_test.rb
M test/unit/friendship_test.rb
M test/unit/account_test.rb
The link on the rubygems page is wrong.
http://rubygems.org/gems/annotate goes to http://github.com/ctran/annotate
When using globalize2 to translate a model, not all fields of the model are actually stored in the table. Some are stored on a separate table called <model_name>_translations. Would it be possible to scan those tables too and annotate the correct model?
For example, if I have a model called Page I have two tables, pages and page_translations. page_translations have the typical id, created_at, updated_at as well as a _id field, in this case page_id and locale fields, that should also be ignored. All other fields can be accessed on the Page model so having it annotated would be useful.
given a model file:
# encoding: utf-8
class MyModel < ActiveRecord::Base
# code contains utf-8 characters
end
after run annotate, it becomes:
# == Schema Information
#
# Table name: my_models
# encoding: utf-8
class MyModel < ActiveRecord::Base
# code contains utf-8 characters
end
this will cause magic comment dont work.
expect:
# encoding: utf-8
# == Schema Information
#
# Table name: my_models
class MyModel < ActiveRecord::Base
# code contains utf-8 characters
end
I have a module called Admin and a class called Admin so the classname is Admin::Admin and the file is in admin/admin.rb
The file does not get annotated.
When attempting to run annotate, I get the following error:
Unable to annotate person.rb: #<RuntimeError: !!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2'>
The mysql2 gem is definitely installed. Thoughts?
I get the following error
Unable to annotate contract.rb: #<MetaProgramming::AliasMethodChainError: method_missing_without_enumerated_attribute already exists. Circular references not permitted.>
I have a model called Task. It doesn't get annotated.
Are they the same thing as the annotate-models?
I like my annotations to be on top of my model definitions (and fixtures etc.).
However almost all my ruby files have non-ascii characters and need to have '# coding: utf-8' at the beginning of each file.
After I run 'annotate -p before' model definitions get inserted before this magic comment and I get many 'invalid multibyte char (US-ASCII)' errors.
Can this be fixed to insert after the magic utf-8 comment?
Trying to annotate a class with a string of capital letters such as IRSDocuments
in a file named "irs_documents.rb" will fail with the message:
Unable to annotate irs_documents.rb: #<NameError: uninitialized constant IrsDocuments>
annotate is a system command used in gdlib2
It would be awesome if this annotated my FactoryGirl factories as well as all the other stuff. I am only opening this issue to let everyone know that I am working on implementing that.
Hi,
I have ruby 1.9.2 and rails 3.1. I am trying to get annotate 2.4.0 to work, but I get nomethod errors. I have tried uninstall and reinstall but it did not help. Please see the spool after the jump. Any suggestions on how to proceed will help
Thanks,
Tabrez
~/myapps/testapp/app>sudo gem install annotate
Fetching: annotate-2.4.0.gem (100%)
Successfully installed annotate-2.4.0
1 gem installed
~/myapps/testapp/app>bundle exec annotate -p before -e Tests, Fixtures
/Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/railties/databases.rake:3:in <top (required)>': undefined method
namespace' for main:Object (NoMethodError)
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in load' from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in
block in load'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in block in load_dependency' from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in
new_constants_in'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in load_dependency' from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in
load'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/railtie.rb:26:in block in <class:Railtie>' from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in
call'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in block in load_tasks' from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in
each'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in load_tasks' from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/engine.rb:396:in
block in load_tasks'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in each' from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in
all'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/engine.rb:396:in load_tasks' from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application.rb:103:in
load_tasks'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in method_missing' from Rakefile:7:in
<top (required)>'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/lib/annotate.rb:17:in load' from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/lib/annotate.rb:17:in
load_tasks'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/bin/annotate:66:in <top (required)>' from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/bin/annotate:19:in
load'
from /Users/mymachine/.rvm/gems/ruby-1.9.2-p290/bin/annotate:19:in `
The Rake task is missing dependencies.
$ rake
Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler
rake aborted!
no such file to load -- spec/rake/spectask
522 % svn st; annotate -p after; annotate -d; svn st; annotate -d -p after; svn st
Curb not found. Using Net::HTTP.
Annotated (9): Account, Answer, Business, Favorite, Friendship, Invitation, Question, Service, User
Curb not found. Using Net::HTTP.
Removed annotation from: Account, Answer, Business, Favorite, Friendship, Invitation, Question, Service, User
M test/unit/user_test.rb
M test/unit/favorite_test.rb
M test/unit/answer_test.rb
M test/unit/service_test.rb
M test/unit/invitation_test.rb
M test/unit/question_test.rb
M test/unit/business_test.rb
M test/unit/friendship_test.rb
M test/unit/account_test.rb
M test/fixtures/accounts.yml
M test/fixtures/users.yml
M test/fixtures/favorites.yml
M test/fixtures/answers.yml
M test/fixtures/businesses.yml
M test/fixtures/services.yml
M test/fixtures/invitations.yml
M test/fixtures/questions.yml
M test/fixtures/friendships.yml
M app/models/user.rb
M app/models/favorite.rb
M app/models/answer.rb
M app/models/service.rb
M app/models/invitation.rb
M app/models/question.rb
M app/models/business.rb
M app/models/friendship.rb
M app/models/account.rb
Curb not found. Using Net::HTTP.
Removed annotation from: Account, Answer, Business, Favorite, Friendship, Invitation, Question, Service, User
M test/unit/user_test.rb
M test/unit/favorite_test.rb
M test/unit/answer_test.rb
M test/unit/service_test.rb
M test/unit/invitation_test.rb
M test/unit/question_test.rb
M test/unit/business_test.rb
M test/unit/friendship_test.rb
M test/unit/account_test.rb
M test/fixtures/accounts.yml
M test/fixtures/users.yml
M test/fixtures/favorites.yml
M test/fixtures/answers.yml
M test/fixtures/businesses.yml
M test/fixtures/services.yml
M test/fixtures/invitations.yml
M test/fixtures/questions.yml
M test/fixtures/friendships.yml
M app/models/user.rb
M app/models/favorite.rb
M app/models/answer.rb
M app/models/service.rb
M app/models/invitation.rb
M app/models/question.rb
M app/models/business.rb
M app/models/friendship.rb
M app/models/account.rb
I have several projects that use namespaced models. Some of those models have the same name as a non-namespaced one (i.e.: a User model and a Legacy::User model).
Annotate 2.4.0 did its job well in those cases. I just upgraded to the Github version today (needed the #56 fix), and it is no longer working on those cases: it applies the non-namespaced model annotations to my namespaced model.
Add to the end of your Rakefile.
Dir["#{Gem.searcher.find('annotate').full_gem_path}/**/tasks/**/*.rake"].each {|ext| load ext}
Minor, but unnecessary. After a while some models have quite a bit of blank space after the end of the model declaration and before the schema information.
It points to http://github.com/ctran/annotate which doesn't exist.
I think it's good idea to have fields sorted in annotation no matter then they were created in DB.
I propose the following order:
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,
When I run the annotate script against my application based on Rails 2.2.2, it halted with following error message:
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:149:in `activate': can't activate activesupport (= 2.2.2, runtime), already activated activesupport-2.3.2 (Gem::Exception)
I have installed both Rails 2.2.2 and Rails 2.3.2.
Hello,
Can you please document how to load the tasks in a Rails project when annotate is installed as a gem instead of as a plugin?
Thanks.
If you're using memoize inside of an AR model, you will receive the following error during annotation.
Unable to annotate [MODEL].rb: #<RuntimeError: Already memoized [METHOD]>
I only want to annotate my models, so every time I have to type '-e tests,fixtures' which is kinda cumbersome.
I've never looked inside gems before so I'm wondering where can I change the default options? Thanks.
I just created a new migration to add a column called "blurb" to a PostgreSQL database. After it ran, I called annotate. It not only could not locate the column, but also when I checked on the database console I saw that it wasn't in the database schema anymore. So I don't know what "annotate" did, but I'm leaning toward not using it anymore until I figure this out.
Now, when I run annotate, it annotates at the end of model, it's not really comfortable, and I have to move annotation every time.
accidentally did, and since it overwrites method_missing for active_record was ignoring all the beautiful built in stuff.
Took some debugging to find it, just in case anyone else runs into this problem
Hello all!
I'm using Ruby 1.9.2 ruby 1.9.2p180 (2011-02-18) [x86_64-darwin10.6.0] and Rails 3.1.3
I'm trying to annotate my models and I'm getting this:
If I run annotate (2.0.2) with userstamp, I get a stack too deep error.
I have two models that use AASM. annotate barfs on models that include the AASM.
Unable to annotate user.rb: stack level too deep (/xxxxx/xxxxx/xxxxx/vendor/plugins/aasm/lib/persistence/active_record_persistence.rb:232:in `aasm_state_without_named_scope')
Any ideas?
For the first time I use this gem. I find it work on a project with rails3.0, yet I fail to make it run with rails3.1. The rails version I use include 3.1.0.rc4 and 3.1.0.rc3.
The error I get is like:
ree-1.8.7-2011.03@r310/gems/activerecord-3.1.0.rc4/lib/active_record/railties/databases.rake:3: undefined method `namespace' for main:Object (NoMethodError) ..... from ./Rakefile:7 from /.rvm/gems/ree-1.8.7-2011.03@r310/gems/annotate-2.4.0/lib/annotate.rb:17:in `load'
The install instructions say to pull from "git clone git://github.com/ctran/annotate_models.git annotate", which is the original creator of the gem. That means users won't get this version.
Change an attribute default value in a migration. Run annotate after. The model in which the default value changed, doesn't get the changed annotations,
At some point, a departed developer had the schema information in our project models at the base of the section of comments before the class. Later, someone else ran annotate in the normal way, which moved all of these back down to the bottom.
While trying to figure out how to get them back up to the top, I found that annotate's -p before will put them above all of the other comments. This is not what I want.
After manually placing them, I find a small change to annotate_models will preserve the previous position. This seems like an all-around good patch. The other option would be adding a new position parameter value for putting it at the bottom of the comments that come before the class definition, but that would clearly be more difficult, and this solution just seems more wise anyway.
It wasn't clear from the README if this worked with Rails 3, it appears to do so, adding install instructions for Rails 3 might clarify, something like
Add to Gemfile
gem 'annotate'
The run 'bundle install'
Im working with Rails 2.3.8. I put the gem in the Gemfile (I work with Bundler) and I have installed too.
$ annotate
./Rakefile:5: uninitialized constant Rake (NameError)
from /usr/lib/ruby/gems/1.8/gems/annotate-2.4.0/lib/annotate.rb:17:in load' from /usr/lib/ruby/gems/1.8/gems/annotate-2.4.0/lib/annotate.rb:17:in
load_tasks'
from /usr/lib/ruby/gems/1.8/gems/annotate-2.4.0/bin/annotate:66
from /usr/bin/annotate:19:in `load'
from /usr/bin/annotate:19
Hello,
Can you release this plug in as a gem so it's easier to install and update?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.