Tag Archives: framework

Efficiently Incrementing Model Attribute Values

Imagine you have a collection of links, and you’re tracking views–you want to easily increment the number of views every time someone clicks on the link. How can you do this? We discuss a number of approaches, from saving the model instance to updating the attribute to using the increment and decrement functions. Continue reading

Posted in Development | Tagged , , | 2 Comments

Using SQL for complex SELECT/ORDER Criteria

How can you select model objects using a complex SQL criterion (such as ordering by a SUM of values)? The answer is to use the find_by_sql method. You can select complex fields, join tables, and sort on those fields–such as sum fields. Continue reading

Posted in Deployment | Tagged , , | Comments Off