sequel 3.34.0 → 3.34.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/CHANGELOG +4 -0
- data/lib/sequel/model/base.rb +3 -2
- data/lib/sequel/version.rb +1 -1
- data/spec/extensions/single_table_inheritance_spec.rb +5 -0
- metadata +1 -1
data/CHANGELOG
CHANGED
data/lib/sequel/model/base.rb
CHANGED
@@ -790,8 +790,9 @@ module Sequel
|
|
790
790
|
def primary_key_lookup(pk)
|
791
791
|
if sql = @fast_pk_lookup_sql
|
792
792
|
sql = sql.dup
|
793
|
-
dataset
|
794
|
-
|
793
|
+
ds = dataset
|
794
|
+
ds.literal_append(sql, pk)
|
795
|
+
ds.fetch_rows(sql){|r| return ds.row_proc.call(r)}
|
795
796
|
nil
|
796
797
|
else
|
797
798
|
dataset[primary_key_hash(pk)]
|
data/lib/sequel/version.rb
CHANGED
@@ -6,7 +6,7 @@ module Sequel
|
|
6
6
|
MINOR = 34
|
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('.')
|
@@ -42,6 +42,11 @@ describe Sequel::Model, "#sti_key" do
|
|
42
42
|
StiTest.all.collect{|x| x.class}.should == [StiTest, StiTestSub1, StiTestSub2]
|
43
43
|
end
|
44
44
|
|
45
|
+
it "should return rows with the correct class based on the polymorphic_key value when retreiving by primary key" do
|
46
|
+
@ds._fetch = [{:kind=>'StiTestSub1'}]
|
47
|
+
StiTest[1].class.should == StiTestSub1
|
48
|
+
end
|
49
|
+
|
45
50
|
it "should return rows with the correct class for subclasses based on the polymorphic_key value" do
|
46
51
|
class ::StiTestSub1Sub < StiTestSub1; end
|
47
52
|
StiTestSub1.dataset._fetch = [{:kind=>'StiTestSub1'}, {:kind=>'StiTestSub1Sub'}]
|