JasonKing-good_sort 0.2.0 → 0.2.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/README.markdown +7 -0
- data/VERSION.yml +1 -1
- data/lib/good_sort/sorter.rb +1 -1
- metadata +3 -2
data/README.markdown
CHANGED
@@ -107,6 +107,13 @@ just specify it using key => value style params, like so:
|
|
107
107
|
sort_on :name, :updated_at, :state => :long_name
|
108
108
|
end
|
109
109
|
|
110
|
+
If you're confident that you know what you're doing, then you can also specify a string for the value of the associated attribute, in which case `good_sort` will just trust you and use this as the `ORDER BY` clause. Make sure you qualify your field names with the join table name if there's any ambiguity. Like so:
|
111
|
+
|
112
|
+
class Author < ActiveRecord::Base
|
113
|
+
belongs_to :state
|
114
|
+
sort_on :name, :updated_at, :state => "COALESCE( states.long_name, states.short_name, '' )"
|
115
|
+
end
|
116
|
+
|
110
117
|
There's also no requirement to cram it all in on one line, you can have multiple
|
111
118
|
`sort_on` declarations, and they will just be accumulated.
|
112
119
|
|
data/VERSION.yml
CHANGED
data/lib/good_sort/sorter.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: JasonKing-good_sort
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason King
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- LICENSE
|
37
37
|
has_rdoc: true
|
38
38
|
homepage: http://github.com/JasonKing/good_sort
|
39
|
+
licenses:
|
39
40
|
post_install_message:
|
40
41
|
rdoc_options:
|
41
42
|
- --inline-source
|
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
58
|
requirements: []
|
58
59
|
|
59
60
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.
|
61
|
+
rubygems_version: 1.3.5
|
61
62
|
signing_key:
|
62
63
|
specification_version: 2
|
63
64
|
summary: TODO
|