I have a real problem with the acts_as_paranoid plugin. The find-scope
nesting does not seem to work at all.
The description:
I made a copy of ''acts_as_paranoid'' in the plugin directory,
renamed it
to ''acts_as_very_new''(just nonsense plugin for testing), and
just
simplified the code:
#--------------------------------------------------------------
module VeryNew
#...
module ClassMethods
def acts_as_very_new
unless is_very_new? # don''t let AR call this twice
class << self
alias_method :find_with_old, :find
end
end
include InstanceMethods
end
# end
module InstanceMethods #:nodoc:
def self.included(base) # :nodoc:
base.extend ClassMethods
end
module ClassMethods
def find(*args)
with_very_new_scope { find_with_old(*args) }
end
protected
def with_very_new_scope(&block)
with_scope({:find => {:conditions =>
["#{table_name}.updated_at > ?", (Time.new - 3.days)]} }, :merge,
&block)
end
end
end
end
--
Posted via http://www.ruby-forum.com/.