sequel 4.1.0 → 4.1.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/CHANGELOG +4 -0
- data/lib/sequel/dataset/actions.rb +2 -2
- data/lib/sequel/version.rb +1 -1
- data/spec/model/eager_loading_spec.rb +17 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e97437793fba5f6d584ca832d9188c5779809da
|
4
|
+
data.tar.gz: bf8b6218bf26ea9dc03387724dc904951e0f81d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fd114ba94ddf1c53718cbf10b8454dac4ad8cceec47414dca2fbd4a21527f7bfd2f2f3811d18f2bf7035631701c7fa54f352af593517f283e09f8f991cc17da
|
7
|
+
data.tar.gz: b171c79c198bd268e1aee3ff16a26369bfcb0eac4abf5787fc47bf0a1cd16dfa95919ded5455fac1dd4d7290bc3066d58df38cd128c1183a7ca593dff531c12c
|
data/CHANGELOG
CHANGED
@@ -589,7 +589,7 @@ module Sequel
|
|
589
589
|
# Returns nil if dataset is empty. Users should generally use
|
590
590
|
# +get+ instead of this method.
|
591
591
|
def single_value
|
592
|
-
if r = naked.
|
592
|
+
if r = ungraphed.naked.single_record
|
593
593
|
r.values.first
|
594
594
|
end
|
595
595
|
end
|
@@ -761,7 +761,7 @@ module Sequel
|
|
761
761
|
|
762
762
|
# Internals of +select_map+ and +select_order_map+
|
763
763
|
def _select_map(column, order, &block)
|
764
|
-
ds = naked
|
764
|
+
ds = ungraphed.naked
|
765
765
|
columns = Array(column)
|
766
766
|
virtual_row_columns(columns, block)
|
767
767
|
select_cols = order ? columns.map{|c| c.is_a?(SQL::OrderedExpression) ? c.expression : c} : columns
|
data/lib/sequel/version.rb
CHANGED
@@ -6,7 +6,7 @@ module Sequel
|
|
6
6
|
MINOR = 1
|
7
7
|
# The tiny version of Sequel. Usually 0, only bumped for bugfix
|
8
8
|
# releases that fix regressions from previous versions.
|
9
|
-
TINY =
|
9
|
+
TINY = 1
|
10
10
|
|
11
11
|
# The version of Sequel you are using, as a string (e.g. "2.11.0")
|
12
12
|
VERSION = [MAJOR, MINOR, TINY].join('.')
|
@@ -839,6 +839,23 @@ describe Sequel::Model, "#eager_graph" do
|
|
839
839
|
proc{GraphAlbum.eager_graph(Object.new)}.should raise_error(Sequel::Error)
|
840
840
|
end
|
841
841
|
|
842
|
+
it "should work correctly with select_map" do
|
843
|
+
ds = GraphAlbum.eager_graph(:band)
|
844
|
+
ds._fetch = [{:id=>1}, {:id=>2}]
|
845
|
+
ds.select_map(:albums__id).should == [1, 2]
|
846
|
+
DB.sqls.should == ['SELECT albums.id FROM albums LEFT OUTER JOIN bands AS band ON (band.id = albums.band_id)']
|
847
|
+
ds._fetch = [{:id=>1}, {:id=>2}]
|
848
|
+
ds.select_map([:albums__id, :albums__id]).should == [[1, 1], [2, 2]]
|
849
|
+
DB.sqls.should == ['SELECT albums.id, albums.id FROM albums LEFT OUTER JOIN bands AS band ON (band.id = albums.band_id)']
|
850
|
+
end
|
851
|
+
|
852
|
+
it "should work correctly with single_value" do
|
853
|
+
ds = GraphAlbum.eager_graph(:band).select(:albums__id)
|
854
|
+
ds._fetch = [{:id=>1}]
|
855
|
+
ds.single_value.should == 1
|
856
|
+
DB.sqls.should == ['SELECT albums.id FROM albums LEFT OUTER JOIN bands AS band ON (band.id = albums.band_id) LIMIT 1']
|
857
|
+
end
|
858
|
+
|
842
859
|
it "should not split results and assign associations if ungraphed is called" do
|
843
860
|
ds = GraphAlbum.eager_graph(:band).ungraphed
|
844
861
|
ds.sql.should == 'SELECT albums.id, albums.band_id, band.id AS band_id_0, band.vocalist_id FROM albums LEFT OUTER JOIN bands AS band ON (band.id = albums.band_id)'
|