hashid-rails 0.3.2 → 0.4.0
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/CHANGELOG.md +3 -0
- data/README.md +17 -2
- data/lib/hashid/rails.rb +0 -1
- data/lib/hashid/rails/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fef0e8c5ec9d05c05dc0d392931d87b9551a6cef
|
4
|
+
data.tar.gz: a0f05a0e3161396920c4fc8561694654cad4dd7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18b71e3b28eedafb5af85e9c737b0f90cc5a4ae4af138551d0644ac3b693def5aa02ff53b76a3acc6c0e35c55c744e2c38b762510d677a37dc9fd1b4a97c48d0
|
7
|
+
data.tar.gz: adabcf0504c995fdd5df9b76f2bf90abb031190bde2c8f51c6adce729bc26c4f20ead54874322d7a53355618eb90df099e80a51294333f3287926a878d40f199
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -29,14 +29,29 @@ Or install it yourself as:
|
|
29
29
|
$ gem install hashid-rails
|
30
30
|
```
|
31
31
|
|
32
|
-
## Usage
|
32
|
+
## Basic Usage
|
33
33
|
|
34
|
-
Just use `Model#find` passing in the hashid instead of the model id
|
34
|
+
Just use `Model#find` passing in the hashid instead of the model id.
|
35
35
|
|
36
36
|
```ruby
|
37
37
|
@person = Person.find(params[:hashid])
|
38
38
|
```
|
39
39
|
|
40
|
+
## Alternative Usage
|
41
|
+
|
42
|
+
You can use the `Model#find_by_hashid` method to find a record without falling
|
43
|
+
back on the standard `find` method. This can be useful in cases where the hashid
|
44
|
+
might be misinterpreted by the `find` method, such as using a hashid containing
|
45
|
+
only numbers that could be both interpreted as either an id and or a hashid.
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
# When a record is found, it returns the record.
|
49
|
+
@person = Person.find_by_hashid(params[:hashid])
|
50
|
+
|
51
|
+
# When no record, is found it raises an exception.
|
52
|
+
ActiveRecord::RecordNotFound
|
53
|
+
```
|
54
|
+
|
40
55
|
## Configuration
|
41
56
|
|
42
57
|
To customize the Hashids seed and ensure that another user of the gem cannot
|
data/lib/hashid/rails.rb
CHANGED
data/lib/hashid/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashid-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Cypret
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,4 +130,3 @@ signing_key:
|
|
130
130
|
specification_version: 4
|
131
131
|
summary: Use Hashids in your Rails app models.
|
132
132
|
test_files: []
|
133
|
-
has_rdoc:
|