Ruby is a wonderful language. And Rails is a wonderful framework. Why ? Because of Duck typing !!! Example : You build a database application for a book store Books are classified by : Genre Author Country On a search page, you can search with a title text field, author select box, genre checkboxes. So …
Tag Archive: programmation
Jul 10
Class : to_s or not to_s ? That is the name !
Many rubyist use the method Class#to_s instead of Class#name My purpose (shared by some programmers) is that to_s is just a String representation of the Class not its name!! Imagine you want to store an ordered list of inherited subclasses as a String so you can retrieve the inheritance order of each subclass. class Parent …
