Monday, September 10, 2007

acts as paranoid on rails1.2.3

The acts_as_paranoid is a great plugin but unfortunately has problems with rails 1.2.3.

Found out it only needed the new extract_options! method of an array. So what I did was just add that method to the array.

create an array_patch.rb in lib and add this:


class Array
def extract_options!
last.is_a?(::Hash) ? pop : {}
end
end


restart app and voila! it works:)

Update:

The :with_deleted option in find was not working. A workaround is to add the :with_deleted key in the VALID_FIND_OPTIONS array in ActiveRecord::Base.


class << ActiveRecord::Base
VALID_FIND_OPTIONS = [ :conditions, :include, :joins, :limit, :offset,
:order, :select, :readonly, :group, :from, :lock, :with_deleted ]
end


This is really not a neat fix but what the hell I'll live with it for the moment:)

0 comments: