{"issue":{"state":"closed","pull_request":{"diff_url":"https://github.com/rails/rails/pull/3481.diff","html_url":"https://github.com/rails/rails/pull/3481","patch_url":"https://github.com/rails/rails/pull/3481.patch"},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/91913f6ab8085bab0f2aa43995ba8ca2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"91913f6ab8085bab0f2aa43995ba8ca2","url":"https://api.github.com/users/bogdan","login":"bogdan","id":122436},"labels":[],"updated_at":"2011-11-17T18:27:13Z","assignee":null,"closed_at":"2011-11-17T18:27:13Z","comments":3,"url":"https://api.github.com/repos/rails/rails/issues/3481","body":"### Use case\r\n\r\nSuppose we have vendored module `A` (extended with `AS::Concern`). This module suppose to be included in class. We want this module to have some additional functionality from another module `B`. In this case I didn't find other way than alias-method-chain `self.included` (any suggestions?).\r\n\r\n### API\r\n\r\nAfter this patch we can just to do this:\r\n\r\n``` ruby\r\nA.included do\r\n  include B\r\nend\r\n```\r\n\r\nIn this case `B` will be included anytime when `A` got included.\r\n\r\n### Implementation\r\n\r\nI was thinking about 2 ways of doing it:\r\n\r\n* store all passed blocks in Array and iterate\r\n* merge new given block to previous by creating new block that calls both (see diff)\r\n\r\nDecided prefer second one because there is no performance impact when calling `.included` only once (as it works right now) - no additional objects, no additional method calls. \r\n\r\nThanks.","html_url":"https://github.com/rails/rails/issues/3481","title":"ActiveSupport::Concern: allow #included to be called multiple times","number":3481,"id":2098067,"created_at":"2011-10-31T15:27:43Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/2940bc7d4506f3e099e3dcc32a412b98?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"2940bc7d4506f3e099e3dcc32a412b98","url":"https://api.github.com/users/jonleighton","login":"jonleighton","id":1979},"updated_at":"2011-11-17T18:27:13Z","url":"https://api.github.com/repos/rails/rails/issues/comments/2779765","body":"Ok, that's true. But going back to your original example, instead of \r\n\r\n``` ruby\r\nA.included do\r\n  include B\r\nend\r\n```\r\n\r\nYou could do:\r\n\r\n``` ruby\r\nA.send(:include, B)\r\nA::ClassMethods.send(:include, B::ClassMethods)\r\n```\r\n\r\nWhich seems ok.\r\n\r\nSorry, but stuff like this is not really appropriate for adding to AS on its own - the general rule is to add stuff to AS either way it will be useful to almost all Rails developers, or where it creates cleanups within Rails core.\r\n\r\nThanks for the patch.","id":2779765,"created_at":"2011-11-17T18:27:13Z"}}