Clear the instance filters after successfully destroying the object.
# File lib/sequel/plugins/instance_filters.rb, line 51 51: def after_destroy 52: super 53: clear_instance_filters 54: end
Clear the instance filters after successfully updating the object.
# File lib/sequel/plugins/instance_filters.rb, line 57 57: def after_update 58: super 59: clear_instance_filters 60: end
Add an instance filter to the array of instance filters Both the arguments given and the block are passed to the dataset’s filter method.
# File lib/sequel/plugins/instance_filters.rb, line 65 65: def instance_filter(*args, &block) 66: instance_filters << [args, block] 67: end
Apply the instance filters to the dataset returned by super.
# File lib/sequel/plugins/instance_filters.rb, line 97 97: def _delete_dataset 98: apply_instance_filters(super) 99: end
If there are any instance filters, make sure not to use the instance delete optimization.
# File lib/sequel/plugins/instance_filters.rb, line 73 73: def _delete_without_checking 74: if @instance_filters && !@instance_filters.empty? 75: _delete_dataset.delete 76: else 77: super 78: end 79: end
Apply the instance filters to the dataset returned by super.
# File lib/sequel/plugins/instance_filters.rb, line 102 102: def _update_dataset 103: apply_instance_filters(super) 104: end
Apply the instance filters to the given dataset
# File lib/sequel/plugins/instance_filters.rb, line 87 87: def apply_instance_filters(ds) 88: instance_filters.inject(ds){|ds, i| ds.filter(*i[0], &i[1])} 89: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.