presenter_object 0.2.9 → 0.3.0

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: bca543507de282711d31da1e5b3d83c3a85974c1
4
- data.tar.gz: a2ec64d7de23bf0c5a7ae77c88eb70d968e62c17
3
+ metadata.gz: f6d5f56909cea81da55f6fa06647c5c592e89a0d
4
+ data.tar.gz: 155ec5e26df26859ca1100f9e5236e6a4d3f6d10
5
5
  SHA512:
6
- metadata.gz: 523a3f56b7b6f59282b16add066b8b237b1b50d19e03b4a9c50f8dd0e9256087030629ec5dd073418f624a15913033d7243cc5bbd459d3d9f3fd59fed4e9c654
7
- data.tar.gz: 3e6450b2fe28c795565edf805007e4569ca1276431eda52228d5fb7ae7db7cd15ce8638098749132eb09be11a229eb33ca847480ac8efb5051188dfabd32a25e
6
+ metadata.gz: 10ed5068e655a2f55f462be13ce75ab18c894cbb82a0644cd2bad525efc6e0a162e087dc7027485b6671b7a9ebd1a50f3cd4b720797e350695593ebaefcaee5e
7
+ data.tar.gz: 07dea83e669fdd515d89751270ccf46028454c2f5caabee4c9e5968fe0d01e9534dbc130424605f03cbfef0d6bcc52fb353778b3f19048a806f0dbc529ff8aa0
@@ -38,7 +38,14 @@ class PresenterObject::Base
38
38
  def initialize(object, view_context = nil)
39
39
  @object = object
40
40
  @class = object.class # impersonate object's class
41
- @to_param = object.id if object.respond_to? :id # let link helpers know the object's id if it has one
41
+ @to_param = parameterize object
42
42
  @view_context = view_context
43
43
  end
44
+
45
+ private
46
+
47
+ # let link helpers know the object's id
48
+ def parameterize(obj)
49
+ obj.respond_to?(:to_param) ? obj.to_param : obj.id.to_s
50
+ end
44
51
  end
@@ -1,3 +1,3 @@
1
1
  module PresenterObject
2
- VERSION = "0.2.9"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: presenter_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Salazar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-19 00:00:00.000000000 Z
11
+ date: 2018-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler