Software engineering and personal development

Tag: object

Demystifying Python’s Method: A Peek into Object Representation

In the realm of Python programming, there’s a special method that offers a glimpse into an object’s soul, revealing its identity and state in a unique way. Meet __repr__, a method that plays a crucial role in the world of object-oriented Python. In this short blog article, we’ll delve into the fascinating world of __repr__, exploring its purpose, usage, and why it’s an essential tool for any developer.

Continue reading

Get previous values of model attributes in Rails using a pre-existing helper

Img source: binarywebpark.com

One of the best practices is keeping your controllers with as little code as possible, and have all the validations in the models. Rails includes a lot of validations that you can use in your models, and many other helpers that help you focus on your business logic and develop your projects as quickly as possible. A helper method that is among the unpopular ones is the possibility to check the old value of an attribute of a object, before doing any database transaction.

Continue reading

© 2024 Fatos Morina

Theme by Anders NorenUp ↑