display_case 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +13 -1
  3. data/lib/display_case/exhibit.rb +1 -1
  4. metadata +11 -12
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d8d1144510cef153b0d10d8657f431f8fc640c31
4
+ data.tar.gz: 20a134bce8da4d671e6e4b4868bb9e3cbac98d0a
5
+ SHA512:
6
+ metadata.gz: 1b3e34382581c183fd291f616f63e3bf9210065844b090ae8e82a88078dbce46c376e2740273d5d7b7fc0a3e081281dbecfd7e372bc412f60cf7b6c8695dbfa8
7
+ data.tar.gz: c86743c255e25f5352104d4473e7984223aa14105a4b0eebffff559e9c47fd49fc3c743b8634162cdbf7a7e17496007dd495685b31dd28fad294ef3cf93b0f52
data/README.md CHANGED
@@ -37,7 +37,17 @@ class LeagueExhibit < DisplayCase::Exhibit
37
37
  end
38
38
 
39
39
  def render_icon(template)
40
- template.render(partial: 'leagues/icon', locals: {league: self})
40
+ # Use `object` local variable in partial to refer back to the exhibited
41
+ # object
42
+ render(template, partial: 'leagues/icon')
43
+
44
+ # OR
45
+
46
+ # Specify a local variable and "reexhibit" the model associated with `self`.
47
+ # Using `exhibit(to_model)` ensures that `league`'s exhibit chain includes
48
+ # all possible exhibit objects instead of just `self` (or LeagueExhibit,
49
+ # in this example).
50
+ render(template, partial: 'leagues/icon', locals: { league: exhibit(to_model) })
41
51
  end
42
52
  end
43
53
  ```
@@ -69,6 +79,8 @@ Finally, in your view, you can use your Exhibit:
69
79
  <% end %>
70
80
  ```
71
81
 
82
+ Note: See [#51](https://github.com/objects-on-rails/display-case/pull/51) for more on the need for `exhibit(to_model)` when rendering a partial from an exhibit.
83
+
72
84
  Configuration
73
85
  -------------
74
86
  Several configuration options can be set via an initializer:
@@ -151,7 +151,7 @@ module DisplayCase
151
151
  end
152
152
 
153
153
  def render(template, options = {})
154
- template.render(options.reverse_merge(:partial => to_partial_path, :object => self))
154
+ template.render(options.reverse_merge(:partial => to_partial_path, :object => exhibit(to_model)))
155
155
  end
156
156
 
157
157
  def exhibited?
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: display_case
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Avdi Grimm
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-03-08 00:00:00.000000000Z
11
+ date: 2014-09-10 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: An implementation of the Exhibit pattern, as described in Objects on
15
14
  Rails
@@ -19,6 +18,9 @@ executables: []
19
18
  extensions: []
20
19
  extra_rdoc_files: []
21
20
  files:
21
+ - LICENSE
22
+ - README.md
23
+ - lib/display_case.rb
22
24
  - lib/display_case/basic_exhibit.rb
23
25
  - lib/display_case/configuration.rb
24
26
  - lib/display_case/enumerable_exhibit.rb
@@ -28,31 +30,28 @@ files:
28
30
  - lib/display_case/is_a_class_comparator.rb
29
31
  - lib/display_case/name_class_comparator.rb
30
32
  - lib/display_case/railtie.rb
31
- - lib/display_case.rb
32
- - LICENSE
33
- - README.md
34
33
  homepage: https://github.com/objects-on-rails/display-case
35
34
  licenses: []
35
+ metadata: {}
36
36
  post_install_message:
37
37
  rdoc_options: []
38
38
  require_paths:
39
39
  - lib
40
40
  required_ruby_version: !ruby/object:Gem::Requirement
41
- none: false
42
41
  requirements:
43
- - - ! '>='
42
+ - - ">="
44
43
  - !ruby/object:Gem::Version
45
44
  version: '0'
46
45
  required_rubygems_version: !ruby/object:Gem::Requirement
47
- none: false
48
46
  requirements:
49
- - - ! '>='
47
+ - - ">="
50
48
  - !ruby/object:Gem::Version
51
49
  version: '0'
52
50
  requirements: []
53
51
  rubyforge_project:
54
- rubygems_version: 1.8.8
52
+ rubygems_version: 2.2.2
55
53
  signing_key:
56
- specification_version: 3
54
+ specification_version: 4
57
55
  summary: An implementation of the Exhibit pattern, as described in Objects on Rails
58
56
  test_files: []
57
+ has_rdoc: