File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -160,8 +160,8 @@ def jsonapi_includes(scope)
160
160
end
161
161
162
162
def jsonapi_sort ( scope )
163
- sort_param = params [ :sort ] || '- id'
164
- dir = sort_param . starts_with? ( '-' ) ? :asc : :desc
163
+ sort_param = params [ :sort ] || 'id'
164
+ dir = sort_param . starts_with? ( '-' ) ? :desc : :asc
165
165
att = sort_param . sub ( '-' , '' ) . to_sym
166
166
167
167
scope = if custom_sort = _jsonapi_config . _sort
Original file line number Diff line number Diff line change @@ -249,19 +249,19 @@ def index
249
249
end
250
250
251
251
context 'asc' do
252
- let ( :sort_param ) { '- first_name' }
252
+ let ( :sort_param ) { 'first_name' }
253
253
254
254
it { is_expected . to eq ( %w( Philip Stephen ) ) }
255
255
end
256
256
257
257
context 'desc' do
258
- let ( :sort_param ) { 'first_name' }
258
+ let ( :sort_param ) { '- first_name' }
259
259
260
260
it { is_expected . to eq ( %w( Stephen Philip ) ) }
261
261
end
262
262
263
263
context 'when given a custom sort function' do
264
- let ( :sort_param ) { '- first_name' }
264
+ let ( :sort_param ) { 'first_name' }
265
265
266
266
before do
267
267
controller . class_eval do
You can’t perform that action at this time.
0 commit comments