Understand ActiveRecord::ReadOnlyRecord error

When you load a record with find options that have SQL fragments in :select or :joins, ActiveRecord will make that record read-only. This is a protective measure by Rails because such a record might have some additional attributes that don't correspond to actual table columns.

You can override that precaution by appending :readonly => false to affected find options or scope options.

Henning Koch