friendly_id 5.2.2 → 5.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -0
- data/.github/stale.yml +17 -0
- data/.github/workflows/test.yml +60 -0
- data/Changelog.md +39 -1
- data/Gemfile +3 -0
- data/README.md +54 -164
- data/Rakefile +2 -2
- data/UPGRADING.md +115 -0
- data/certs/parndt.pem +25 -0
- data/friendly_id.gemspec +9 -5
- data/gemfiles/Gemfile.rails-5.0.rb +2 -2
- data/gemfiles/{Gemfile.rails-4.2.rb → Gemfile.rails-5.1.rb} +4 -5
- data/gemfiles/{Gemfile.rails-4.1.rb → Gemfile.rails-5.2.rb} +5 -7
- data/gemfiles/{Gemfile.rails-4.0.rb → Gemfile.rails-6.0.rb} +5 -8
- data/lib/friendly_id/base.rb +4 -8
- data/lib/friendly_id/candidates.rb +0 -2
- data/lib/friendly_id/configuration.rb +3 -2
- data/lib/friendly_id/finder_methods.rb +18 -7
- data/lib/friendly_id/finders.rb +1 -1
- data/lib/friendly_id/history.rb +21 -12
- data/lib/friendly_id/initializer.rb +11 -0
- data/lib/friendly_id/migration.rb +9 -3
- data/lib/friendly_id/object_utils.rb +9 -2
- data/lib/friendly_id/reserved.rb +1 -0
- data/lib/friendly_id/scoped.rb +9 -2
- data/lib/friendly_id/sequentially_slugged.rb +12 -2
- data/lib/friendly_id/slug.rb +4 -0
- data/lib/friendly_id/slug_generator.rb +6 -1
- data/lib/friendly_id/slugged.rb +3 -3
- data/lib/friendly_id/version.rb +1 -1
- data/test/databases.yml +6 -4
- data/test/finders_test.rb +24 -0
- data/test/helper.rb +13 -3
- data/test/history_test.rb +86 -7
- data/test/numeric_slug_test.rb +31 -0
- data/test/object_utils_test.rb +5 -3
- data/test/reserved_test.rb +10 -0
- data/test/schema.rb +19 -2
- data/test/scoped_test.rb +13 -0
- data/test/sequentially_slugged_test.rb +59 -0
- data/test/shared.rb +4 -4
- data/test/simple_i18n_test.rb +2 -2
- data/test/slugged_test.rb +168 -4
- metadata +48 -19
- metadata.gz.sig +0 -0
- data/.travis.yml +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6fa83b80901ae7c4930b4a0dea61544152f2cc4a7d94b828c2f52e807fb5d686
|
4
|
+
data.tar.gz: b5db403619e2d9bc275d567dc9f567fb943316e1222bc9c6052e43a285b92116
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8c8bef9ec1e0a42103fa813d40b087bcb84c1f3148f73d53d21fde568865b9a6dc0a2c83508431a2ffa2c2b09bf7f3d26e49b30ac09a758e39dd02323aff328
|
7
|
+
data.tar.gz: 0f78de10e8d9597728e554dc53949318f23a5771adb8014b23172c204f550c48b5f2222f8df144a4368d5f34560f01051a5f42183fcac415f85ad9e1bfb262e4
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
data/.github/stale.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Number of days of inactivity before an issue becomes stale
|
2
|
+
daysUntilStale: 42
|
3
|
+
# Number of days of inactivity before a stale issue is closed
|
4
|
+
daysUntilClose: 7
|
5
|
+
# Issues with these labels will never be considered stale
|
6
|
+
exemptLabels:
|
7
|
+
- pinned
|
8
|
+
- security
|
9
|
+
# Label to use when marking an issue as stale
|
10
|
+
staleLabel: stale
|
11
|
+
# Comment to post when marking an issue as stale. Set to `false` to disable
|
12
|
+
markComment: >
|
13
|
+
This issue has been automatically marked as stale because it has not had
|
14
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
15
|
+
for your contributions.
|
16
|
+
# Comment to post when closing a stale issue. Set to `false` to disable
|
17
|
+
closeComment: false
|
@@ -0,0 +1,60 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- 'master'
|
7
|
+
pull_request:
|
8
|
+
jobs:
|
9
|
+
test:
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
architecture: [ x64 ]
|
13
|
+
database: [ mysql, postgresql ]
|
14
|
+
gemfile: [ '6.0', '5.2', '5.1', '5.0' ]
|
15
|
+
ruby: [ '2.6.x', '2.5.x' ]
|
16
|
+
fail-fast: false
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
name: ${{ matrix.ruby }} ${{ matrix.database }} rails-${{ matrix.gemfile }}
|
19
|
+
steps:
|
20
|
+
- uses: actions/setup-ruby@v1.0.0
|
21
|
+
with:
|
22
|
+
architecture: ${{ matrix.architecture }}
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
version: ${{ matrix.ruby }}
|
25
|
+
- uses: actions/checkout@v1
|
26
|
+
- run: sudo apt-get update && sudo apt-get install libpq-dev postgresql-client libmysqlclient-dev mysql-client libsqlite3-dev -y
|
27
|
+
- id: cache-bundler
|
28
|
+
uses: actions/cache@v1
|
29
|
+
with:
|
30
|
+
path: vendor/bundle
|
31
|
+
key: ${{ matrix.ruby }}-gem-${{ hashFiles(format('gemfiles/Gemfile.rails-{0}.rb', matrix.gemfile)) }}
|
32
|
+
- run: gem install bundler
|
33
|
+
- run: bundle install --path vendor/bundle
|
34
|
+
- run: bundle exec rake db:create db:up
|
35
|
+
- run: bundle exec rake test
|
36
|
+
|
37
|
+
env:
|
38
|
+
BUNDLE_JOBS: 4
|
39
|
+
BUNDLE_GEMFILE: gemfiles/Gemfile.rails-${{ matrix.gemfile }}.rb
|
40
|
+
BUNDLE_PATH: vendor/bundle
|
41
|
+
CI: true
|
42
|
+
COVERALLS: true
|
43
|
+
DB: ${{ matrix.database }}
|
44
|
+
MYSQL_PASSWORD: root
|
45
|
+
PGHOST: localhost
|
46
|
+
PGPORT: 5432
|
47
|
+
PGUSER: postgres
|
48
|
+
RAILS_ENV: test
|
49
|
+
|
50
|
+
services:
|
51
|
+
postgres:
|
52
|
+
image: postgres:11.5
|
53
|
+
ports: ["5432:5432"]
|
54
|
+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
55
|
+
mysql:
|
56
|
+
image: mysql:5.7
|
57
|
+
ports: ["3306:3306"]
|
58
|
+
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 5
|
59
|
+
env:
|
60
|
+
MYSQL_ROOT_PASSWORD: root
|
data/Changelog.md
CHANGED
@@ -3,6 +3,44 @@
|
|
3
3
|
We would like to think our many [contributors](https://github.com/norman/friendly_id/graphs/contributors) for
|
4
4
|
suggestions, ideas and improvements to FriendlyId.
|
5
5
|
|
6
|
+
## Unreleased
|
7
|
+
|
8
|
+
## 5.4.0 (2020-08-14)
|
9
|
+
|
10
|
+
* Fix Ruby 2.7 keyword params deprecation warning ([#939](https://github.com/norman/friendly_id/pull/939))
|
11
|
+
* Fix Slug Validation in `unset_slug_if_invalid` ([#938](https://github.com/norman/friendly_id/pull/938))
|
12
|
+
* Make `first_by_friendly_id` case insensitive using `downcase` ([#787](https://github.com/norman/friendly_id/pull/787))
|
13
|
+
* Use `destroy_all` rather than `delete_all` when creating historical slugs ([#924](https://github.com/norman/friendly_id/pull/924))
|
14
|
+
* Set required ruby version to `>= 2.1.0` ([#923](https://github.com/norman/friendly_id/pull/923))
|
15
|
+
* Avoid using deprecated `update_attributes` ([#922](https://github.com/norman/friendly_id/pull/922))
|
16
|
+
|
17
|
+
## 5.3.0 (2019-09-25)
|
18
|
+
|
19
|
+
* Record history when scope changes but slug does not ([#916](https://github.com/norman/friendly_id/pull/916))
|
20
|
+
* Add support for Rails 6 ([#897](https://github.com/norman/friendly_id/pull/897))
|
21
|
+
|
22
|
+
## 5.2.5 (2018-12-30)
|
23
|
+
|
24
|
+
* Pass all possible parameters to ActiveRecord::RecordNotFound.new when raising the exception ([#890](https://github.com/norman/friendly_id/pull/890))
|
25
|
+
* Use composite index for queries by sluggable ([#882](https://github.com/norman/friendly_id/pull/882))
|
26
|
+
* Scoped: generate new slug if scope changed ([#878](https://github.com/norman/friendly_id/pull/878))
|
27
|
+
* Fix History + SequentiallySlugged issues ([#877](https://github.com/norman/friendly_id/pull/877))
|
28
|
+
* Support scoped with STI ([#745](https://github.com/norman/friendly_id/pull/745))
|
29
|
+
* Fix exists? to behave the same as find for numeric slugs ([#875](https://github.com/norman/friendly_id/pull/875))
|
30
|
+
* Remove dirty tracking code from to_param ([#867](https://github.com/norman/friendly_id/pull/867))
|
31
|
+
|
32
|
+
## 5.2.4 (2018-04-24)
|
33
|
+
|
34
|
+
* Fix compatibility with Rails versions 4.0 -> 5.2. ([#863](https://github.com/norman/friendly_id/pull/863)).
|
35
|
+
* Refactor `History::FinderMethods` to use base implementation. ([#853](https://github.com/norman/friendly_id/pull/853)).
|
36
|
+
* Defer loading of ActiveRecord to avoid config issues. ([#852](https://github.com/norman/friendly_id/pull/852)).
|
37
|
+
* Ensure compatibility with paranoid deletion libraries. ([#838](https://github.com/norman/friendly_id/pull/838)).
|
38
|
+
* Add treat_reserved_as_conflict option to initializer ([#847](https://github.com/norman/friendly_id/pull/847)).
|
39
|
+
|
40
|
+
## 5.2.3 (2017-09-22)
|
41
|
+
|
42
|
+
* Added option to treat reserved words as conflicts ([#831](https://github.com/norman/friendly_id/pull/831)).
|
43
|
+
|
6
44
|
## 5.2.2 (2017-09-13)
|
7
45
|
|
8
46
|
* Prevent warning on db:migrate in Rails 5.1 ([#826](https://github.com/norman/friendly_id/pull/826)).
|
@@ -24,7 +62,7 @@ suggestions, ideas and improvements to FriendlyId.
|
|
24
62
|
* Don't calculate all changes just to check if the param field has changed ([#667](https://github.com/norman/friendly_id/pull/667)).
|
25
63
|
* Don't set or change slug when unrelated validation failures block the record from being saved ([#642](https://github.com/norman/friendly_id/issues/642)).
|
26
64
|
* Fix order dependence bug between history and finders modules ([#718](https://github.com/norman/friendly_id/pull/718))
|
27
|
-
* Added ability to conditionally turn off
|
65
|
+
* Added ability to conditionally turn off `:dependent => :destroy` on FriendlyId::Slugs([#724](https://github.com/norman/friendly_id/pull/724))
|
28
66
|
* Add support for Rails 5. ([#728](https://github.com/norman/friendly_id/pull/728))
|
29
67
|
* Allow per-model conditional disabling of friendly path generation using a :routes option to friendly_id ([#735](https://github.com/norman/friendly_id/pull/735))
|
30
68
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,19 +1,7 @@
|
|
1
|
-
[![Build Status](https://
|
1
|
+
[![Build Status](https://github.com/norman/friendly_id/workflows/CI/badge.svg)](https://github.com/norman/friendly_id/actions)
|
2
2
|
[![Code Climate](https://codeclimate.com/github/norman/friendly_id.svg)](https://codeclimate.com/github/norman/friendly_id)
|
3
3
|
[![Inline docs](http://inch-ci.org/github/norman/friendly_id.svg?branch=master)](http://inch-ci.org/github/norman/friendly_id)
|
4
4
|
|
5
|
-
**GETTING HELP**
|
6
|
-
|
7
|
-
Please ask questions on [Stack
|
8
|
-
Overflow](http://stackoverflow.com/questions/tagged/friendly-id) using the
|
9
|
-
"friendly-id" tag. Prior to asking, search and see if your question has
|
10
|
-
already been answered.
|
11
|
-
|
12
|
-
Please only post issues in Github issues for actual bugs.
|
13
|
-
|
14
|
-
I am asking people to do this because the same questions keep getting asked
|
15
|
-
over and over and over again in the issues.
|
16
|
-
|
17
5
|
# FriendlyId
|
18
6
|
|
19
7
|
**For the most complete, user-friendly documentation, see the [FriendlyId Guide](http://norman.github.io/friendly_id/file.Guide.html).**
|
@@ -31,186 +19,88 @@ instead of:
|
|
31
19
|
http://example.com/states/4323454
|
32
20
|
|
33
21
|
|
34
|
-
##
|
35
|
-
|
36
|
-
FriendlyId offers many advanced features, including: slug history and
|
37
|
-
versioning, i18n, scoped slugs, reserved words, and custom slug generators.
|
38
|
-
|
39
|
-
### What Changed in Version 5.1
|
40
|
-
|
41
|
-
5.1 is a bugfix release, but bumps the minor version because some applications may be dependent
|
42
|
-
on the previously buggy behavior. The changes include:
|
43
|
-
|
44
|
-
* Blank strings can no longer be used as slugs.
|
45
|
-
* When the first slug candidate is rejected because it is reserved, additional candidates will
|
46
|
-
now be considered before marking the record as invalid.
|
47
|
-
* The `:finders` module is now compatible with Rails 4.2.
|
48
|
-
|
49
|
-
### What Changed in Version 5.0
|
50
|
-
|
51
|
-
As of version 5.0, FriendlyId uses [semantic versioning](http://semver.org/). Therefore, as you might
|
52
|
-
infer from the version number, 5.0 introduces changes incompatible with 4.0.
|
53
|
-
|
54
|
-
The most important changes are:
|
55
|
-
|
56
|
-
* Finders are no longer overridden by default. If you want to do friendly finds,
|
57
|
-
you must do `Model.friendly.find` rather than `Model.find`. You can however
|
58
|
-
restore FriendlyId 4-style finders by using the `:finders` addon:
|
59
|
-
|
60
|
-
```ruby
|
61
|
-
friendly_id :foo, use: :slugged # you must do MyClass.friendly.find('bar')
|
62
|
-
# or...
|
63
|
-
friendly_id :foo, use: [:slugged, :finders] # you can now do MyClass.find('bar')
|
64
|
-
```
|
65
|
-
* A new "candidates" functionality which makes it easy to set up a list of
|
66
|
-
alternate slugs that can be used to uniquely distinguish records, rather than
|
67
|
-
appending a sequence. For example:
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
class Restaurant < ActiveRecord::Base
|
71
|
-
extend FriendlyId
|
72
|
-
friendly_id :slug_candidates, use: :slugged
|
73
|
-
|
74
|
-
# Try building a slug based on the following fields in
|
75
|
-
# increasing order of specificity.
|
76
|
-
def slug_candidates
|
77
|
-
[
|
78
|
-
:name,
|
79
|
-
[:name, :city],
|
80
|
-
[:name, :street, :city],
|
81
|
-
[:name, :street_number, :street, :city]
|
82
|
-
]
|
83
|
-
end
|
84
|
-
end
|
85
|
-
```
|
86
|
-
* Now that candidates have been added, FriendlyId no longer uses a numeric
|
87
|
-
sequence to differentiate conflicting slug, but rather a UUID (e.g. something
|
88
|
-
like `2bc08962-b3dd-4f29-b2e6-244710c86106`). This makes the
|
89
|
-
codebase simpler and more reliable when running concurrently, at the expense
|
90
|
-
of uglier ids being generated when there are conflicts.
|
91
|
-
* The default sequence separator has been changed from two dashes to one dash.
|
92
|
-
* Slugs are no longer regenerated when a record is saved. If you want to regenerate
|
93
|
-
a slug, you must explicitly set the slug column to nil:
|
94
|
-
|
95
|
-
```ruby
|
96
|
-
restaurant.friendly_id # joes-diner
|
97
|
-
restaurant.name = "The Plaza Diner"
|
98
|
-
restaurant.save!
|
99
|
-
restaurant.friendly_id # joes-diner
|
100
|
-
restaurant.slug = nil
|
101
|
-
restaurant.save!
|
102
|
-
restaurant.friendly_id # the-plaza-diner
|
103
|
-
```
|
104
|
-
|
105
|
-
You can restore some of the old behavior by overriding the
|
106
|
-
`should_generate_new_friendly_id?` method.
|
107
|
-
* The `friendly_id` Rails generator now generates an initializer showing you
|
108
|
-
how to do some common global configuration.
|
109
|
-
* The Globalize plugin has moved to a [separate gem](https://github.com/norman/friendly_id-globalize) (currently in alpha).
|
110
|
-
* The `:reserved` module no longer includes any default reserved words.
|
111
|
-
Previously it blocked "edit" and "new" everywhere. The default word list has
|
112
|
-
been moved to `config/initializers/friendly_id.rb` and now includes many more
|
113
|
-
words.
|
114
|
-
* The `:history` and `:scoped` addons can now be used together.
|
115
|
-
* Since it now requires Rails 4, FriendlyId also now requires Ruby 1.9.3 or
|
116
|
-
higher.
|
117
|
-
|
118
|
-
#### Upgrading from FriendlyId 4.0
|
119
|
-
|
120
|
-
Run `rails generate friendly_id --skip-migration` and edit the initializer
|
121
|
-
generated in `config/initializers/friendly_id.rb`. This file contains notes
|
122
|
-
describing how to restore (or not) some of the defaults from FriendlyId 4.0.
|
123
|
-
|
124
|
-
If you want to use the `:history` and `:scoped` addons together, you must add a
|
125
|
-
`:scope` column to your friendly_id_slugs table and replace the unique index on
|
126
|
-
`:slug` and `:sluggable_type` with a unique index on those two columns, plus
|
127
|
-
the new `:scope` column.
|
128
|
-
|
129
|
-
A migration like this should be sufficient:
|
130
|
-
|
131
|
-
```ruby
|
132
|
-
add_column :friendly_id_slugs, :scope, :string
|
133
|
-
remove_index :friendly_id_slugs, [:slug, :sluggable_type]
|
134
|
-
add_index :friendly_id_slugs, [:slug, :sluggable_type]
|
135
|
-
add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], unique: true
|
136
|
-
```
|
137
|
-
|
138
|
-
## Articles
|
22
|
+
## Getting Help
|
139
23
|
|
140
|
-
|
141
|
-
[
|
24
|
+
Ask questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/friendly-id)
|
25
|
+
using the "friendly-id" tag, and for bugs have a look at [the bug section](https://github.com/norman/friendly_id#bugs)
|
142
26
|
|
143
|
-
##
|
144
|
-
|
145
|
-
The most current docs from the master branch can always be found
|
146
|
-
[here](http://norman.github.io/friendly_id).
|
147
|
-
|
148
|
-
Docs for older versions are also available:
|
27
|
+
## FriendlyId Features
|
149
28
|
|
150
|
-
|
151
|
-
* [4.0](http://norman.github.io/friendly_id/4.0/)
|
152
|
-
* [3.3](http://norman.github.io/friendly_id/3.3/)
|
153
|
-
* [2.3](http://norman.github.io/friendly_id/2.3/)
|
29
|
+
FriendlyId offers many advanced features, including:
|
154
30
|
|
155
|
-
|
156
|
-
|
157
|
-
|
31
|
+
* slug history and versioning
|
32
|
+
* i18n
|
33
|
+
* scoped slugs
|
34
|
+
* reserved words
|
35
|
+
* custom slug generators
|
158
36
|
|
159
|
-
|
37
|
+
## Usage
|
160
38
|
|
161
|
-
|
162
|
-
which is now somewhat outdated but still relevant.
|
39
|
+
Add this line to your application's Gemfile:
|
163
40
|
|
41
|
+
```ruby
|
42
|
+
gem 'friendly_id', '~> 5.2.4' # Note: You MUST use 5.0.0 or greater for Rails 4.0+
|
43
|
+
```
|
164
44
|
|
165
|
-
|
45
|
+
And then execute:
|
166
46
|
|
167
47
|
```shell
|
168
|
-
|
169
|
-
cd my_app
|
48
|
+
bundle install
|
170
49
|
```
|
171
|
-
|
172
|
-
|
173
|
-
|
50
|
+
|
51
|
+
Add a `slug` column to the desired table (e.g. `Users`)
|
52
|
+
```shell
|
53
|
+
rails g migration AddSlugToUsers slug:uniq
|
174
54
|
```
|
55
|
+
|
56
|
+
Generate the friendly configuration file and a new migration
|
57
|
+
|
175
58
|
```shell
|
176
59
|
rails generate friendly_id
|
177
60
|
```
|
178
|
-
|
179
|
-
`
|
180
|
-
|
61
|
+
|
62
|
+
Note: You can delete the `CreateFriendlyIdSlugs` migration if you won't use the slug history feature. ([Read more](https://norman.github.io/friendly_id/FriendlyId/History.html))
|
63
|
+
|
64
|
+
Run the migration scripts
|
65
|
+
|
181
66
|
```shell
|
182
|
-
rails
|
183
|
-
rake db:migrate
|
67
|
+
rails db:migrate
|
184
68
|
```
|
69
|
+
|
70
|
+
Edit the `app/models/user.rb` file as the following:
|
71
|
+
|
185
72
|
```ruby
|
186
|
-
# edit app/models/user.rb
|
187
73
|
class User < ApplicationRecord
|
188
74
|
extend FriendlyId
|
189
75
|
friendly_id :name, use: :slugged
|
190
76
|
end
|
77
|
+
```
|
191
78
|
|
192
|
-
User.
|
79
|
+
Edit the `app/controllers/users_controller.rb` file and replace `User.find` by `User.friendly.find`
|
193
80
|
|
194
|
-
|
195
|
-
|
81
|
+
```ruby
|
82
|
+
class UserController < ApplicationController
|
83
|
+
def show
|
84
|
+
@user = User.friendly.find(params[:id])
|
85
|
+
end
|
86
|
+
end
|
196
87
|
```
|
197
|
-
```shell
|
198
|
-
rails server
|
199
88
|
|
200
|
-
|
201
|
-
|
89
|
+
Now when you create a new user like the following:
|
90
|
+
|
202
91
|
```ruby
|
203
|
-
|
204
|
-
# to generate slugs for existing users, do this from the
|
205
|
-
# console, runner, or add a Rake task:
|
206
|
-
User.find_each(&:save)
|
92
|
+
User.create! name: "Joe Schmoe"
|
207
93
|
```
|
208
94
|
|
209
|
-
|
95
|
+
You can then access the user show page using the URL http://localhost:3000/users/joe-schmoe.
|
96
|
+
|
210
97
|
|
211
|
-
|
212
|
-
|
98
|
+
If you're adding FriendlyId to an existing app and need to generate slugs for
|
99
|
+
existing users, do this from the console, runner, or add a Rake task:
|
213
100
|
|
101
|
+
```ruby
|
102
|
+
User.find_each(&:save)
|
103
|
+
```
|
214
104
|
|
215
105
|
## Bugs
|
216
106
|
|
@@ -227,8 +117,8 @@ If you have a bug to report, please include the following information:
|
|
227
117
|
If you are able to, it helps even more if you can fork FriendlyId on Github,
|
228
118
|
and add a test that reproduces the error you are experiencing.
|
229
119
|
|
230
|
-
For more
|
231
|
-
article](
|
120
|
+
For more inspiration on how to report bugs, please see [this
|
121
|
+
article](https://www.chiark.greenend.org.uk/~sgtatham/bugs.html).
|
232
122
|
|
233
123
|
## Thanks and Credits
|
234
124
|
|
data/Rakefile
CHANGED
@@ -71,7 +71,7 @@ namespace :db do
|
|
71
71
|
driver = FriendlyId::Test::Database.driver
|
72
72
|
config = FriendlyId::Test::Database.config[driver]
|
73
73
|
commands = {
|
74
|
-
"mysql" => "mysql -u #{config['username']} -e 'create database #{config["database"]};' >/dev/null",
|
74
|
+
"mysql" => "mysql -h #{config['host']} -P #{config['port']} -u #{config['username']} --password=#{config['password']} -e 'create database #{config["database"]};' >/dev/null",
|
75
75
|
"postgres" => "psql -c 'create database #{config['database']};' -U #{config['username']} >/dev/null"
|
76
76
|
}
|
77
77
|
%x{#{commands[driver] || true}}
|
@@ -83,7 +83,7 @@ namespace :db do
|
|
83
83
|
driver = FriendlyId::Test::Database.driver
|
84
84
|
config = FriendlyId::Test::Database.config[driver]
|
85
85
|
commands = {
|
86
|
-
"mysql" => "mysql -u #{config['username']} -e 'drop database #{config["database"]};' >/dev/null",
|
86
|
+
"mysql" => "mysql -h #{config['host']} -P #{config['port']} -u #{config['username']} --password=#{config['password']} -e 'drop database #{config["database"]};' >/dev/null",
|
87
87
|
"postgres" => "psql -c 'drop database #{config['database']};' -U #{config['username']} >/dev/null"
|
88
88
|
}
|
89
89
|
%x{#{commands[driver] || true}}
|