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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 188a86224138acd83725017f18c52814d274c69b
4
- data.tar.gz: 52e5e1d4e6a80aaa5f5e11ca4f98a42bfbba83a0
3
+ metadata.gz: 41474948f7aba7e32ecde31f8d78aaa779de25ad
4
+ data.tar.gz: 9c8af8da926e23660453ff6dadb87b9d63f71c94
5
5
  SHA512:
6
- metadata.gz: ec173164d09767cd3f337c676afdfcff778c0565902fbc28bc8599486ba488649396d860e1324bd496b8a9f32756a99d15ef669db1fdd8531d0c5d983d6fd1e0
7
- data.tar.gz: 9ee45c0096255ad673d1918076d4391907a7b4e3205f7a2872a378d30d1e85654fb3d795565a376cd1f6a3bfdd97812db8b064c61d530683048cc5790fb3b58f
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
@@ -38,9 +38,6 @@ Foo.find(3)
38
38
  Foo.find("ePQgabdg")
39
39
  # => #<Foo:0x007feb5978a7c0 id: 3>
40
40
 
41
- Foo.find_by_hashids("ePQgabdg")
42
- # => #<Foo:0x007feb5978a7c0 id: 3>
43
-
44
41
  Foo.with_hashids("ePQgabdg").first
45
42
  # => #<Foo:0x007feb5978a7c0 id: 3>
46
43
  ```
@@ -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
@@ -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(id: decoded_ids)
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.call : secret) || base_class.name
13
+ (secret.respond_to?(:call) ? instance_exec(&secret) : secret) || base_class.name
14
14
  end
15
15
 
16
16
  define_singleton_method :hashids do
@@ -1,3 +1,3 @@
1
1
  module ActsAsHashids
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
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.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-06 00:00:00.000000000 Z
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