querybuilder 1.0.0 → 1.0.1
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/History.txt +5 -0
- data/lib/query_builder/info.rb +1 -1
- data/lib/query_builder/processor.rb +13 -13
- data/querybuilder.gemspec +2 -2
- metadata +4 -4
data/History.txt
CHANGED
data/lib/query_builder/info.rb
CHANGED
@@ -76,7 +76,7 @@ module QueryBuilder
|
|
76
76
|
def load_custom_queries!
|
77
77
|
return unless list = self.custom_query_files
|
78
78
|
klass = nil
|
79
|
-
self.custom_queries ||= {}
|
79
|
+
self.custom_queries ||= {'all' => {}}
|
80
80
|
Dir.glob(list.flatten).each do |dir|
|
81
81
|
if File.directory?(dir)
|
82
82
|
Dir.foreach(dir) do |file|
|
@@ -708,19 +708,19 @@ module QueryBuilder
|
|
708
708
|
def custom_query_without_loading(relation)
|
709
709
|
return false unless first? && last? # current safety net until "from" is correctly implemented and tested
|
710
710
|
|
711
|
-
custom_queries = self.class.custom_queries
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
711
|
+
if custom_queries = self.class.custom_queries
|
712
|
+
queries = custom_queries[@opts[:custom_query_group]] || {}
|
713
|
+
rel = relation.singularize
|
714
|
+
if custom_query = queries[rel] || custom_queries['all'][rel]
|
715
|
+
custom_query.each do |k,v|
|
716
|
+
@query.send(:instance_variable_set, "@#{k}", prepare_custom_query_arguments(k.to_sym, v))
|
717
|
+
end
|
718
|
+
# rebuild table alias
|
719
|
+
@query.rebuild_tables!
|
720
|
+
# rebuild 'select' aliases
|
721
|
+
@query.rebuild_attributes_hash!
|
722
|
+
true
|
718
723
|
end
|
719
|
-
# rebuild table alias
|
720
|
-
@query.rebuild_tables!
|
721
|
-
# rebuild 'select' aliases
|
722
|
-
@query.rebuild_attributes_hash!
|
723
|
-
true
|
724
724
|
end
|
725
725
|
end
|
726
726
|
|
data/querybuilder.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{querybuilder}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Gaspard Bucher"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-07-11}
|
13
13
|
s.description = %q{QueryBuilder is an interpreter for the "pseudo sql" language. This language
|
14
14
|
can be used for two purposes:
|
15
15
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: querybuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gaspard Bucher
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-11 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|