collection_sorter 0.0.2 → 0.0.3

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.
@@ -18,8 +18,7 @@ module CollectionSorter
18
18
  end
19
19
 
20
20
  def apply_sort(scope, default=nil)
21
- params = {} unless params
22
- sorter = params[:sort] || default || (return scope)
21
+ sorter = (request.params[:sort] rescue nil) || default || (return scope)
23
22
  sorter = default unless self.sorters.include?(sorter.to_sym)
24
23
 
25
24
  return self.sorters[sorter.to_sym].call(scope) if sorter.present?
@@ -1,3 +1,3 @@
1
1
  module CollectionSorter
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -219,3 +219,47 @@ ControllerTest: test_included_in_ActionController
219
219
  SorterTest: test_should_sort_a_collection
220
220
  -----------------------------------------
221
221
   (0.1ms) rollback transaction
222
+  (0.6ms) begin transaction
223
+ --------------------------------
224
+ CollectionSorterTest: test_truth
225
+ --------------------------------
226
+  (0.2ms) rollback transaction
227
+  (0.1ms) begin transaction
228
+ ------------------------------
229
+ ControllerTest: test_GET_index
230
+ ------------------------------
231
+ Processing by HomeController#index as HTML
232
+ Completed 200 OK in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
233
+  (0.1ms) rollback transaction
234
+  (0.1ms) begin transaction
235
+ -------------------------------------------------
236
+ ControllerTest: test_included_in_ActionController
237
+ -------------------------------------------------
238
+  (0.1ms) rollback transaction
239
+  (0.1ms) begin transaction
240
+ -----------------------------------------
241
+ SorterTest: test_should_sort_a_collection
242
+ -----------------------------------------
243
+  (0.1ms) rollback transaction
244
+  (0.3ms) begin transaction
245
+ --------------------------------
246
+ CollectionSorterTest: test_truth
247
+ --------------------------------
248
+  (0.1ms) rollback transaction
249
+  (0.1ms) begin transaction
250
+ ------------------------------
251
+ ControllerTest: test_GET_index
252
+ ------------------------------
253
+ Processing by HomeController#index as HTML
254
+ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms)
255
+  (0.1ms) rollback transaction
256
+  (0.1ms) begin transaction
257
+ -------------------------------------------------
258
+ ControllerTest: test_included_in_ActionController
259
+ -------------------------------------------------
260
+  (0.1ms) rollback transaction
261
+  (0.0ms) begin transaction
262
+ -----------------------------------------
263
+ SorterTest: test_should_sort_a_collection
264
+ -----------------------------------------
265
+  (0.0ms) rollback transaction
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collection_sorter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: