This is a single post from deeden.co.uk made during the period May 2002 to April 2009. During a previous grand redesign I decided to make a break with the past and consign the old entries to history. This entry is from August 2006 and lives here forevermore.

acts_as_priceable ActiveRecord::ReadOnlyRecord error

This is a heads-up for other people using acts_as_priceable who may encounter the same error that I came across. While using the wonderfully useful plugin over the weekend I came key geting the error ActiveRecord::ReadOnlyRecord when the line existing_price.save was called in acts_as_priceable.rb. After much digging around I discovered that this is possibly due to the change in Rails 1.12 which made joins return read-only records from ActiveRecord.

The simple fix is to add the line existing_price = Price.find(existing_price.id) after the is_a line. This recreates the record, if found, as a writable record.