Created
November 14, 2013 17:20
-
-
Save PragTob/7470687 to your computer and use it in GitHub Desktop.
When a module (B) is included into another module (M) before that module is included into another class (A), everything works fine and the methods of the second module (B) are accessible. However if it is included after the original module (M) was included in the class (A), the method is not known.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module M | |
| end | |
| module B | |
| def a | |
| puts 'wuhuuu' | |
| end | |
| end | |
| class A | |
| include M | |
| end | |
| M.send(:include, B) | |
| A.new.a # raises no method error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module M | |
| end | |
| module B | |
| def a | |
| puts 'wuhuuu' | |
| end | |
| end | |
| M.send(:include, B) | |
| class A | |
| include M | |
| end | |
| A.new.a # works fine (wuhuuu) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SELECT * FROM Sites WHERE ParentId = @id