Scott Rutherford

Life on and off the Rails

 

Out of the box acts_as_paranoid comes with the ability to define a belongs_to relationship as including deleted records (although to get it to work you need to add require File.dirname(FILE) + ’/lib/caboose/acts/belongs_to_with_deleted_association’ to the init.rb file):

class ModelA < ActiveRecord::Base
  belongs_to :model_b, :with_deleted => true
end

This works quite nicely for that ModelA, but what happens if you want to include the deleted ModelA’s from ModelB through a has_one relationship…... its falls over. However that is easily fixed.

Read the rest of this entry
This blog used the Shay theme as a base and is powered by Mephisto