query_optimizer 0.1.4 → 0.1.4.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.
- checksums.yaml +4 -4
- data/README.rdoc +2 -2
- data/lib/query_optimizer.rb +1 -1
- data/lib/query_optimizer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a4ba5ffff4c072fa6aa16b4a7730c26bcdfbf336
|
|
4
|
+
data.tar.gz: 61bd033570dd1dec6b21558b0958fdc61cb84ade
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c32e0fcebf3fed8653d2f2892cac5026abcc09fb0394ebb144611450727ff4133a04114c5ea368e180115fb710f1acff8f6114923e0d836d59a9cae04b70b05f
|
|
7
|
+
data.tar.gz: 448a9b70eb01bb3beb71b4f1e39a27167be6768c66090de69a00276188528ac2cb807ea887d1409b6fbcd115671914bb77719eed9cd84b3995d80bbe1bebe193
|
data/README.rdoc
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
== FEATURES:
|
|
8
8
|
|
|
9
|
-
query_optimizer is the best gem for optimizing query in rails for has_many or has_one and belongs_to relationship
|
|
9
|
+
query_optimizer is the best gem for optimizing query in rails for has_many or has_one and belongs_to relationship.
|
|
10
10
|
In rails If you want all posts and its related comments in a single query than you can't get it
|
|
11
|
-
as Post.
|
|
11
|
+
as Post.includes(:comments) or Post.joins(:comments) will return only posts array and Comment.includes(:posts) will return only comments array
|
|
12
12
|
For fetching each post comment you have to fire query from view as below output of post.comments in each with index loop.
|
|
13
13
|
|
|
14
14
|
Started GET "/" for 127.0.0.1 at 2015-10-18 14:12:11 +0530
|
data/lib/query_optimizer.rb
CHANGED
|
@@ -17,7 +17,7 @@ module QueryOptimizer
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
tables = args.map{|p| p.to_s}.join(',')
|
|
20
|
-
return ActiveRecord::Base.connection.select_all("SELECT #{aliases.join(',')} FROM #{tables} where #{joins.join(' ')}
|
|
20
|
+
return ActiveRecord::Base.connection.select_all("SELECT #{aliases.join(',')} FROM #{tables} where #{joins.join(' ')} ORDER BY #{args.first.to_s}_id desc").to_a
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: query_optimizer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.4
|
|
4
|
+
version: 0.1.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Akshay
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-12-
|
|
11
|
+
date: 2015-12-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|