Displaying 2 results from an estimated 2 matches for "with_very_new_scop".
Did you mean:
with_very_new_scope
2006 May 11
1
acts_as_paranoid and nested scopes in Rails 1.1
...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 h...
2006 May 11
0
acts_as_paranoid, aliasing and nested scopes in Rails 1.1
...as_very_new
unless is_very_new?
class << self
alias_method :find_with_old, :find
end
end
include InstanceMethods
end
#...
end
module InstanceMethods #:nodoc:
#...
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
#----------------...