You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a qualified primary key for Model.paged_each and for the paged_operations plugin when using joined datasets
This adds an unambiguous_primary_key private model dataset method,
which returns the qualified primary key for the model if the dataset
is joined, or the unqualified primary key for the model otherwise.
This changes the _force_primary_key_order private model dataset
method to use unambiguous_primary_key, so that it will use a
qualified version of the primary key automatically if the dataset
is joined. It makes the same change to the _paged_operations_pk
method in the paged_operations plugin.
Fixes#2300
Co-authored-by: Dave Kroondyk <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG
+2
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
=== master
2
2
3
+
* Use a qualified primary key for Model.paged_each and for the paged_operations plugin when using joined datasets (jeremyevans, davekaro) (#2299, #2300)
4
+
3
5
* Add Model.qualified_primary_key for returning a qualified version of the model's primary key (jeremyevans)
4
6
5
7
* Support sql_literal_allow_caching? method on objects that respond to sql_literal_append/sql_literal (jeremyevans)
raiseError,"the paged_operations plugin is not supported on DB2 when using emulated offsets, set the :offset_strategy Database option to 'limit_offset' or 'offset_fetch'"
158
158
end
159
159
160
-
casepk=model.primary_key
160
+
casepk=unambiguous_primary_key
161
161
whenSymbol
162
162
Sequel.identifier(pk)
163
163
whenArray
164
164
raiseError,"cannot use #{meth} on a model with a composite primary key"
165
-
else
165
+
whennil
166
166
raiseError,"cannot use #{meth} on a model without a primary key"
167
+
else
168
+
# Likely SQL::QualifiedIdentifier, if the dataset is joined.
0 commit comments