singapore mobile app developer,web designer singapore,developers in singapore,web design company singapore,app development singapore,website design singapore,mobile developer singapore,mobile app developer singapore,ruby on rails developer singapore,web development company singapore,web development singapore,website designer singapore,website developer singapore,singapore web design services,web application singapore,ios app development singapore,ios developer singapore,web design singapore,mobile application development singapore,web design services singapore,singapore web development,mobile apps development singapore,singapore app developer,app developer singapore,design firms in singapore,singapore web design,mobile app development singapore,mobile game developer singapore,singapore website design,website development singapore,singapore mobile application developer,design agency singapore,graphic designer in singapore,developer in singapore,mobile application developer singapore,mobile apps singapore,android developer singapore
Ruby underscore and classify methods
These are two Rails helpers that could be very useful when injecting new instance methods in a class.
Converts from a class name to a underscore attribute.
‘MyClassName’.underscore => my_class_name
Inverse method from underscore.
Both, combined with singularize and pluralize, allows us to handle parent/child methods in a very handy way. For example:
elements_in_ = self.send(parent).send(self.class.to_s.pluralize.underscore)
or things like
Kernel.const_get(table_model.to_s.classify).find(:all) #Kernel.const_get gets an string and retrieves the class.