aub-record_filter 0.9.9 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/lib/record_filter/active_record.rb +7 -1
- data/record_filter.gemspec +3 -3
- data/spec/restrictions_spec.rb +7 -0
- data/spec/test.db +0 -0
- metadata +4 -3
data/VERSION.yml
CHANGED
@@ -95,8 +95,14 @@ module RecordFilter
|
|
95
95
|
@local_named_filters ||= []
|
96
96
|
end
|
97
97
|
end
|
98
|
+
|
99
|
+
module AssociationInstanceMethods
|
100
|
+
def filter(&block)
|
101
|
+
Filter.new(@reflection.klass, nil, &block)
|
102
|
+
end
|
103
|
+
end
|
98
104
|
end
|
99
105
|
end
|
100
106
|
|
101
107
|
ActiveRecord::Base.send(:extend, RecordFilter::ActiveRecordExtension::ClassMethods)
|
102
|
-
|
108
|
+
ActiveRecord::Associations::AssociationCollection.send(:include, RecordFilter::ActiveRecordExtension::AssociationInstanceMethods)
|
data/record_filter.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{record_filter}
|
5
|
-
s.version = "0.9.
|
5
|
+
s.version = "0.9.10"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Aubrey Holland", "Mat Brown"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-08-09}
|
10
10
|
s.description = %q{RecordFilter is a Pure-ruby criteria API for building complex queries in ActiveRecord. It supports queries that are built on the fly as well as named filters that can be added to objects and chained to create complex queries. It also gets rid of the nasty hard-coded SQL that shows up in most ActiveRecord code with a clean API that makes queries simple and intuitive to build.}
|
11
11
|
s.email = %q{aubreyholland@gmail.com}
|
12
12
|
s.extra_rdoc_files = [
|
@@ -69,7 +69,7 @@ Gem::Specification.new do |s|
|
|
69
69
|
s.homepage = %q{http://github.com/aub/record_filter/tree/master}
|
70
70
|
s.rdoc_options = ["--charset=UTF-8"]
|
71
71
|
s.require_paths = ["lib"]
|
72
|
-
s.rubygems_version = %q{1.3.
|
72
|
+
s.rubygems_version = %q{1.3.5}
|
73
73
|
s.summary = %q{An ActiveRecord query API for replacing SQL with awesome}
|
74
74
|
s.test_files = [
|
75
75
|
"spec/active_record_spec.rb",
|
data/spec/restrictions_spec.rb
CHANGED
@@ -240,4 +240,11 @@ describe 'RecordFilter restrictions' do
|
|
240
240
|
end.inspect
|
241
241
|
Post.last_find.should == { :readonly => false, :conditions => [%q(("posts".id > ?) AND (("posts".id < ?) OR (("posts".id > ?) OR ("posts".id < ?)))), 56, 200, 500, 15] }
|
242
242
|
end
|
243
|
+
|
244
|
+
it 'should properly filter when filter is applied to an association' do
|
245
|
+
Post.first.comments.filter do
|
246
|
+
with(:offensive, true)
|
247
|
+
end.inspect
|
248
|
+
Comment.last_find.should == { :readonly => false, :conditions => [%q("comments".offensive = ?), true] }
|
249
|
+
end
|
243
250
|
end
|
data/spec/test.db
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aub-record_filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aubrey Holland
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-08-09 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- test/test.db
|
78
78
|
has_rdoc: false
|
79
79
|
homepage: http://github.com/aub/record_filter/tree/master
|
80
|
+
licenses:
|
80
81
|
post_install_message:
|
81
82
|
rdoc_options:
|
82
83
|
- --charset=UTF-8
|
@@ -97,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
98
|
requirements: []
|
98
99
|
|
99
100
|
rubyforge_project:
|
100
|
-
rubygems_version: 1.
|
101
|
+
rubygems_version: 1.3.5
|
101
102
|
signing_key:
|
102
103
|
specification_version: 3
|
103
104
|
summary: An ActiveRecord query API for replacing SQL with awesome
|