Because the params hash is just a hash a mistake imho rather than a hashlike object you can t monkeypatch it easily.
Ruby monkeypatch method.
Seeing that these custom methods are used only in the context of a certain module class i request for a way to define a method.
One of the most powerful aspects of ruby is the ability to re open any class and change it s methods.
Now this is obviously.
If you express the relation properly activerecord will do it for you class tweet belongs to original tweet class name.
This includes the standard ruby classes like string array or hash.
You can write a flatten one level method but otherwise i think 18 is the best way.
You can add methods right to core classes.
The term monkey patch seems to have come from an earlier term guerrilla patch which referred to changing code sneakily and possibly incompatibly with other such patches at runtime.
An alternative etymology is that it refers to monkeying about.
When you first try ruby it s amazing.
Some frameworks libraries monkeypatch their own methods on ruby core classes like string hash array etc and that is often causing problems concerns of name conflict.
It makes ruby a joy to read and write.
Until you hit weird bugs because a patch changed hash.
Second you need to call user reload in order for the changes from your rake task to be available.
First off you should put created at in the create method.
Tweet has many retweets class name.
1 you can write 1 day ago.
Destroy inverse of original tweet end tweet last destroy will now destroy dependents.
Seeing that these custom methods are used only in the context of a certain module class i request for a way to define a method foo on a module class a so that it will be visible only from within a specified module class.
You get confused about which code actually ran so you can t debug it when it breaks.
One of the coolest features in ruby is the existence of modules and the possibility of including their implementation in any object.
Stack level too deep because recursion.
The word guerrilla homophonous with gorilla or nearly so became monkey possibly to make the patch sound less intimidating.
Writing for ruby inside i get to see a lot of ruby code.
Yes that s right you can actually reopen any class and change how it works.
This simple behavior is the source of things like the enumerable module that gives you a bunch of methods to work with a collection of objects and just expects that the class that included it to define an each method.