{"action":"created","issue":{"url":"https://api.github.com/repos/ctran/annotate_models/issues/295","labels_url":"https://api.github.com/repos/ctran/annotate_models/issues/295/labels{/name}","comments_url":"https://api.github.com/repos/ctran/annotate_models/issues/295/comments","events_url":"https://api.github.com/repos/ctran/annotate_models/issues/295/events","html_url":"https://github.com/ctran/annotate_models/issues/295","id":118311746,"number":295,"title":"Annotate.load_tasks raising no build task error for 'annotate_models' for Engines","user":{"login":"djsegal","id":3156114,"avatar_url":"https://avatars.githubusercontent.com/u/3156114?v=3","gravatar_id":"","url":"https://api.github.com/users/djsegal","html_url":"https://github.com/djsegal","followers_url":"https://api.github.com/users/djsegal/followers","following_url":"https://api.github.com/users/djsegal/following{/other_user}","gists_url":"https://api.github.com/users/djsegal/gists{/gist_id}","starred_url":"https://api.github.com/users/djsegal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djsegal/subscriptions","organizations_url":"https://api.github.com/users/djsegal/orgs","repos_url":"https://api.github.com/users/djsegal/repos","events_url":"https://api.github.com/users/djsegal/events{/privacy}","received_events_url":"https://api.github.com/users/djsegal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-23T03:06:18Z","updated_at":"2015-11-23T23:35:36Z","closed_at":null,"body":"----------\r\n\r\nRelated to issue: #190 \r\n\r\n+ Error is for non-mountable engines\r\n+ Previous workaround was running `annotate` in the `spec/dummy` subdirectory (i.e. not having annotate run after every `db:migrate`)\r\n\r\n----------\r\n\r\n```\r\n❯❯❯❯ rake db:migrate                                                                                                code/ahab_core master\r\nrake aborted!\r\nDon't know how to build task 'annotate_models'\r\n/Users/dan/.rvm/gems/ruby-2.2.3/gems/annotate-2.6.7/lib/tasks/migrate.rake:29:in `update_annotations'\r\n```"},"comment":{"url":"https://api.github.com/repos/ctran/annotate_models/issues/comments/159104471","html_url":"https://github.com/ctran/annotate_models/issues/295#issuecomment-159104471","issue_url":"https://api.github.com/repos/ctran/annotate_models/issues/295","id":159104471,"user":{"login":"djsegal","id":3156114,"avatar_url":"https://avatars.githubusercontent.com/u/3156114?v=3","gravatar_id":"","url":"https://api.github.com/users/djsegal","html_url":"https://github.com/djsegal","followers_url":"https://api.github.com/users/djsegal/followers","following_url":"https://api.github.com/users/djsegal/following{/other_user}","gists_url":"https://api.github.com/users/djsegal/gists{/gist_id}","starred_url":"https://api.github.com/users/djsegal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djsegal/subscriptions","organizations_url":"https://api.github.com/users/djsegal/orgs","repos_url":"https://api.github.com/users/djsegal/repos","events_url":"https://api.github.com/users/djsegal/events{/privacy}","received_events_url":"https://api.github.com/users/djsegal/received_events","type":"User","site_admin":false},"created_at":"2015-11-23T23:35:36Z","updated_at":"2015-11-23T23:35:36Z","body":"---\r\n\r\n#### Note: \r\n\r\nTo get this to work in the parent repo and the engine/subtree repo, I also had to change the `auto_annotate_models.rake` that was within my subtree's lib.\r\n\r\n---\r\n\r\nThis took two parts:\r\n\r\n1 – namespacing set_annotation_options inside engine (I chose engine arbitrarily):\r\n\r\n```\r\n# in lib/subtree/lib/tasks/auto_annotate_models.rake:\r\n\r\nnamespace :engine do\r\n  task :set_annotation_options do\r\n    Annotate.set_defaults(\r\n      ...\r\n    )\r\n  end\r\nend\r\n```\r\n\r\n2 – adding an initializer to the engine to selectively undo namespacing:\r\n\r\n```\r\n    initializer :fix_migrations do |app|\r\n      if app.root.to_s.match root.to_s\r\n        task :set_annotation_options do\r\n          Rake::Task[\"engine:set_annotation_options\"].invoke\r\n        end\r\n      else\r\n        ...\r\n      end\r\n    end\r\n```"}}