Module Caboose::Acts::Paranoid::ActiveRecord::InstanceMethods::ClassMethods
In: lib/acts_as_paranoid.rb

Methods

Public Instance methods

[Source]

    # File lib/acts_as_paranoid.rb, line 91
91:             def count(conditions = nil, joins = nil)
92:               with_deleted_scope { count_with_deleted(conditions, joins) }
93:             end

[Source]

    # File lib/acts_as_paranoid.rb, line 76
76:             def find(*args)
77:               options = extract_options_from_args!(args)
78:               call_original_find = lambda { original_find(*(args << options)) }
79:             
80:               if !options[:with_deleted]
81:                 with_deleted_scope { return call_original_find.call }
82:               end
83:             
84:               call_original_find.call
85:             end

[Source]

    # File lib/acts_as_paranoid.rb, line 87
87:             def find_with_deleted(*args)
88:               original_find(*(args << extract_options_from_args!(args).merge(:with_deleted => true)))
89:             end

[Source]

     # File lib/acts_as_paranoid.rb, line 95
 95:             def with_scope(method_scoping = {}, is_new_scope = true)
 96:               # Dup first and second level of hash (method and params).
 97:               method_scoping = method_scoping.inject({}) do |hash, (method, params)|
 98:                 hash[method] = params.dup
 99:                 hash
100:               end
101: 
102:               method_scoping.assert_valid_keys [:find, :create]
103:               if f = method_scoping[:find]
104:                 f.assert_valid_keys [:conditions, :joins, :offset, :limit, :readonly]
105:                 f[:readonly] = true if !f[:joins].blank? && !f.has_key?(:readonly)
106:               end
107: 
108:               raise ArgumentError, "Nested scopes are not yet supported: #{scoped_methods.inspect}" unless scoped_methods.nil?
109: 
110:               self.scoped_methods = method_scoping
111:               yield
112:             ensure
113:               self.scoped_methods = nil if is_new_scope
114:             end

[Validate]