Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The poingant guide link (implimentation of the "belongs_to" class function) is a string of redirects. Anyone have a copy of the original?


http://poignant.guide/book/chapter-6.html#section3

edit:

While I love _why's guide, which can be very useful for learning ruby metaprogramming (and ruby in general), the technique presented there is a bit outdated. Modern ruby doesn't require such an "ugly" style because we now have Object#define_singleton_method[1] as a way of defining class level methods. There shouldn't be a need to use #instance_eval to define methods in the metaclass.

[1] https://ruby-doc.org/core-2.2.2/Object.html#method-i-define_...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: