collection_sorter 0.0.1 → 0.0.2
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/README.rdoc +26 -1
- data/lib/collection_sorter/version.rb +1 -1
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -1,3 +1,28 @@
|
|
1
1
|
= CollectionSorter
|
2
2
|
|
3
|
-
This
|
3
|
+
This gem is used for sorting collection in a rails controller
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
Put `gem 'collection_sorter'` in your Gemfile, then run `bundle install`
|
8
|
+
|
9
|
+
== Usage
|
10
|
+
|
11
|
+
In your rails controller you can now define sorting logic
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
class UsersController < ApplicationController::Base
|
15
|
+
sort_with :most_handsome do |scope|
|
16
|
+
scope.order('handsomeness ASC')
|
17
|
+
end
|
18
|
+
|
19
|
+
# GET /users?sort=most_handsome
|
20
|
+
def index
|
21
|
+
@users = User.all
|
22
|
+
@users = apply_sort(@users)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
== Contribute
|
27
|
+
|
28
|
+
Fork the source code from github and tweak away.
|
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.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
-
description:
|
46
|
+
description: Rails plugin to sort collection based on params
|
47
47
|
email:
|
48
48
|
- rbudiharso@gmail.com
|
49
49
|
executables: []
|
@@ -102,7 +102,7 @@ files:
|
|
102
102
|
- test/dummy/test/fixtures/songs.yml
|
103
103
|
- test/sorter_test.rb
|
104
104
|
- test/test_helper.rb
|
105
|
-
homepage:
|
105
|
+
homepage: https://github.com/rbudiharso/collection_sorter
|
106
106
|
licenses: []
|
107
107
|
post_install_message:
|
108
108
|
rdoc_options: []
|
@@ -125,7 +125,7 @@ rubyforge_project:
|
|
125
125
|
rubygems_version: 1.8.23
|
126
126
|
signing_key:
|
127
127
|
specification_version: 3
|
128
|
-
summary:
|
128
|
+
summary: Rails plugin to sort collection based on params
|
129
129
|
test_files:
|
130
130
|
- test/collection_sorter_test.rb
|
131
131
|
- test/controller_test.rb
|