activerecord-collation 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.
- checksums.yaml +4 -4
- data/README.md +8 -6
- data/lib/active_record/collation/schema_dumper.rb +2 -2
- data/lib/active_record/collation/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a515beeae2f125a1faffb9d4826ecb4566a9482b756a7d65996b6a07981d217f
|
|
4
|
+
data.tar.gz: 2ed5a94b19f28dfbfc319668218afa21f26e1b348af3e197d0910830647395d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bf9dd9072a26592c5574be4bcf38b4400900ca82235520a6832de7f7792e72a506e46c9385db5bf6985802527a2cc12251b702659d09ec22b73f14fa7d275e93
|
|
7
|
+
data.tar.gz: ae3cd929eff72e689b55bead8eb7c4f8531781a1e1e9376f577651d193eee82bff3dd4b71a85a074ada9e60db3bd6196a40b6f840070873aba9215b9bdb2513f
|
data/README.md
CHANGED
|
@@ -18,17 +18,17 @@ See [Postgres collation documentation](https://www.postgresql.org/docs/current/c
|
|
|
18
18
|
|
|
19
19
|
## Setup
|
|
20
20
|
|
|
21
|
-
Add `activerecord-collations` to your dependencies.
|
|
21
|
+
Add `activerecord-collations` to your dependencies. Include the collation concern into your models to get access to the `collate` class method.
|
|
22
22
|
|
|
23
23
|
```ruby
|
|
24
24
|
class ApplicationRecord < ActiveRecord::Base
|
|
25
|
-
|
|
25
|
+
primary_abstract_class
|
|
26
26
|
|
|
27
27
|
include ActiveRecord::Collation
|
|
28
28
|
end
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
The collate method creates an ARel expression for the column with a certain collation.
|
|
31
|
+
The `collate` method creates an ARel expression for the column with a certain collation.
|
|
32
32
|
|
|
33
33
|
```ruby
|
|
34
34
|
scope :ordered, -> { order(collate(:title, "natural_#{I18n.locale}") }
|
|
@@ -45,11 +45,13 @@ Arel::Nodes::InfixOperation.new(
|
|
|
45
45
|
)
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
##
|
|
48
|
+
## Development
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Run tests in this repository with `rake`. Migrations are exercised by running them in the dummy application.
|
|
51
51
|
|
|
52
52
|
```
|
|
53
53
|
cd test/dummy
|
|
54
|
-
RAILS_ENV=test rake db:migrate
|
|
54
|
+
rm -f db/schema.rb && RAILS_ENV=test bundle exec rake db:drop db:create db:migrate
|
|
55
|
+
cd ../../
|
|
56
|
+
bundle exec rake
|
|
55
57
|
```
|
|
@@ -10,15 +10,15 @@ module ActiveRecord
|
|
|
10
10
|
collations = @connection.collations
|
|
11
11
|
return unless collations.any?
|
|
12
12
|
|
|
13
|
-
stream.puts
|
|
14
13
|
collations.each do |row|
|
|
15
14
|
stream.puts(
|
|
16
15
|
" create_collation(#{row['collname'].inspect}, #{row['colllocale'].inspect})"
|
|
17
16
|
)
|
|
18
17
|
end
|
|
18
|
+
stream.puts
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def tables(stream)
|
|
22
22
|
collations(stream)
|
|
23
23
|
super
|
|
24
24
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord-collation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Manfred Stienstra
|
|
@@ -24,7 +24,7 @@ dependencies:
|
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '0'
|
|
26
26
|
description: " Adds methods like create_collation to manage collations in your Ruby
|
|
27
|
-
on
|
|
27
|
+
on Rails project.\n"
|
|
28
28
|
email:
|
|
29
29
|
- manfred@fngtps.com
|
|
30
30
|
executables: []
|
|
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
59
|
version: '0'
|
|
60
60
|
requirements: []
|
|
61
|
-
rubygems_version:
|
|
61
|
+
rubygems_version: 4.0.10
|
|
62
62
|
specification_version: 4
|
|
63
63
|
summary: Collation support for Active Record.
|
|
64
64
|
test_files: []
|