acts_as_hashids 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -1
- data/Gemfile +2 -4
- data/README.md +0 -3
- data/acts_as_hashids.gemspec +3 -0
- data/lib/acts_as_hashids/core.rb +2 -1
- data/lib/acts_as_hashids/methods.rb +1 -1
- data/lib/acts_as_hashids/version.rb +1 -1
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41474948f7aba7e32ecde31f8d78aaa779de25ad
|
4
|
+
data.tar.gz: 9c8af8da926e23660453ff6dadb87b9d63f71c94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1721af397d23ce5bc1a9e144b1544cca27b7a00ee6ff4bafd8a97d41f0cd6115939bf940d7f9ffc1a3471deaeafeebbb1cf142152c43292755bc188c73f49fcd
|
7
|
+
data.tar.gz: 73c94cebf1836f15f8c0f49fa38f59d3a89f7a546940327078e3895c8b801e8d5a392689e70550938f9d1c8482757d6180be2eba6399db5f6bdf0f5db8414c4d
|
data/.travis.yml
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
language: ruby
|
2
2
|
sudo: required
|
3
3
|
rvm:
|
4
|
-
- 2.1
|
5
4
|
- 2.2
|
6
5
|
- 2.3.0
|
6
|
+
env:
|
7
|
+
-
|
8
|
+
- ACTIVE_RECORD_VERSION=4.0
|
9
|
+
- ACTIVE_RECORD_VERSION=4.1
|
10
|
+
- ACTIVE_RECORD_VERSION=4.2
|
11
|
+
- ACTIVE_RECORD_VERSION=5.0.0.beta4
|
7
12
|
cache: bundler
|
8
13
|
install:
|
9
14
|
- 'gem install bundler'
|
data/Gemfile
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
+
gem 'activerecord', "~> #{ENV['ACTIVE_RECORD_VERSION']}" if ENV['ACTIVE_RECORD_VERSION'].to_s != ''
|
4
|
+
|
3
5
|
# Specify your gem's dependencies in acts_as_hashids.gemspec
|
4
6
|
gemspec
|
5
|
-
|
6
|
-
gem 'simplecov', '~> 0.11.2', require: false
|
7
|
-
gem 'coveralls', '~> 0.8.13', require: false
|
8
|
-
gem 'codeclimate-test-reporter', '~> 0.5.0', require: false
|
data/README.md
CHANGED
data/acts_as_hashids.gemspec
CHANGED
@@ -28,4 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
29
29
|
spec.add_development_dependency 'rubocop', '= 0.37.2'
|
30
30
|
spec.add_development_dependency 'rubocop-rspec', '= 1.4.0'
|
31
|
+
spec.add_development_dependency 'simplecov', '~> 0.11'
|
32
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
33
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.5'
|
31
34
|
end
|
data/lib/acts_as_hashids/core.rb
CHANGED
@@ -5,6 +5,7 @@ module ActsAsHashids
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
def to_param
|
8
|
+
id = public_send(self.class.primary_key)
|
8
9
|
id && self.class.hashids.encode(id)
|
9
10
|
end
|
10
11
|
|
@@ -45,7 +46,7 @@ module ActsAsHashids
|
|
45
46
|
decoded_ids = ids.map { |id| hashids.decode(id) }.flatten
|
46
47
|
raise ActsAsHashids::Exception, "Decode error: #{ids.inspect}" if ids.size != decoded_ids.size
|
47
48
|
|
48
|
-
where(
|
49
|
+
where(primary_key => decoded_ids)
|
49
50
|
end
|
50
51
|
|
51
52
|
def has_many(*args, &block) # rubocop:disable Style/PredicateName
|
@@ -10,7 +10,7 @@ module ActsAsHashids
|
|
10
10
|
|
11
11
|
define_singleton_method :hashids_secret do
|
12
12
|
secret = options[:secret]
|
13
|
-
(secret.respond_to?(:call) ? secret
|
13
|
+
(secret.respond_to?(:call) ? instance_exec(&secret) : secret) || base_class.name
|
14
14
|
end
|
15
15
|
|
16
16
|
define_singleton_method :hashids do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_hashids
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dtaniwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashids
|
@@ -122,6 +122,48 @@ dependencies:
|
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.4.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.11'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.11'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: coveralls
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.8'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.8'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: codeclimate-test-reporter
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.5'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.5'
|
125
167
|
description: Use Hashids in ActiveRecord effectively.
|
126
168
|
email:
|
127
169
|
- daisuketaniwaki@gmail.com
|