Tag Archives: activerecord

automatically handle StaleObjectError in rails 3.x

There are different reasons why a ActiveRecord::StaleObjectError would occur. Sometimes it is caused because rails does not have a stable identity map yet. This means that if the same object would be retrieved via different associations, your rails process would not know they point to the same object, would keep different copies of the same [...]

rewriting find_by_sql for rails 3

I am starting in Rails 3. I have a simple situation where i would select a parent based on a condition of one of its children. Normally i would write something like: Although this works, it is not the best solution to take. For one, it is vulnerable to sql-injection and secondly it shows a [...]