jbuilder 2.11.3 → 2.11.5

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
  SHA256:
3
- metadata.gz: 4dacba51a263fc3bcbea4471ae1557dea10c014f68657a39ab812e55a167eba9
4
- data.tar.gz: 544f954ce6f89f7775853b91bfc99f5f1634596389f5750028e13532b314a63c
3
+ metadata.gz: 9ce8fbeac8b34ee290535e98a284a1247e2de1b5272c4679c1b89a89ff8149db
4
+ data.tar.gz: cdaeb1302c4755ca43f037328698afe29fe658f2094c99e2c6f81f0000b9368c
5
5
  SHA512:
6
- metadata.gz: a71638ae38f5755b97a40db81c2121f92788b3e4242de6d4789032f0ff7bab4f62d2dd96b7cab19e8583ee448946bb2e66e8cf5f6ab65c7b514ff88c19af1407
7
- data.tar.gz: cd3477c065ebdbacc5da5d383973e996499cce7872d8303691376739732735441b003981a767af1bdb8ccea6648685291ff20e81c662a95ad54c87205ba233f9
6
+ metadata.gz: 6903b1aa13786fd5501d8e667eb7a913ebd469d24ce183a24cdf949a62788b1e598c2e0678c5ed5e369d4232c7720e284850f735c5be6f4691e4ecf42256d21a
7
+ data.tar.gz: 2a40e415a25a4d8680ac00ba81b9984188ef35440869a357db4fd7184d3f0b36d0ce10545a0d5253e6d12374b2f1d51f5a96f1ded1370ec7eddecaee469afc61
@@ -4,7 +4,7 @@ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  test:
7
- name: Ruby test
7
+ name: Ruby ${{ matrix.ruby }} (${{ matrix.gemfile }})
8
8
  runs-on: ubuntu-20.04
9
9
  continue-on-error: ${{ matrix.experimental }}
10
10
  env:
@@ -14,82 +14,82 @@ jobs:
14
14
  strategy:
15
15
  fail-fast: false
16
16
  matrix:
17
- ruby: [
18
- 2.2.10,
19
- 2.3.8,
20
- 2.4.10,
21
- 2.5.8,
22
- 2.6.6,
23
- 2.7.1,
24
- 3.0.0
25
- ]
26
- gemfile: [
27
- "rails_5_0",
28
- "rails_5_1",
29
- "rails_5_2",
30
- "rails_6_0",
31
- "rails_6_1",
32
- "rails_head"
33
- ]
17
+ ruby:
18
+ - "2.2"
19
+ - "2.3"
20
+ - "2.4"
21
+ - "2.5"
22
+ - "2.6"
23
+ - "2.7"
24
+ - "3.0"
25
+
26
+ gemfile:
27
+ - "rails_5_0"
28
+ - "rails_5_1"
29
+ - "rails_5_2"
30
+ - "rails_6_0"
31
+ - "rails_6_1"
32
+ - "rails_head"
33
+
34
34
  experimental: [false]
35
35
  exclude:
36
- - ruby: 2.7.1
36
+ - ruby: 2.7
37
37
  gemfile: rails_5_0
38
- - ruby: 3.0.0
38
+ - ruby: '3.0'
39
39
  gemfile: rails_5_0
40
40
  - ruby: head
41
41
  gemfile: rails_5_0
42
- - ruby: 2.7.1
42
+ - ruby: 2.7
43
43
  gemfile: rails_5_1
44
- - ruby: 3.0.0
44
+ - ruby: '3.0'
45
45
  gemfile: rails_5_1
46
46
  - ruby: head
47
47
  gemfile: rails_5_1
48
- - ruby: 2.2.10
48
+ - ruby: 2.2
49
49
  gemfile: rails_5_2
50
- - ruby: 2.7.1
50
+ - ruby: 2.7
51
51
  gemfile: rails_5_2
52
- - ruby: 3.0.0
52
+ - ruby: '3.0'
53
53
  gemfile: rails_5_2
54
54
  - ruby: head
55
55
  gemfile: rails_5_2
56
- - ruby: 2.2.10
56
+ - ruby: 2.2
57
57
  gemfile: rails_6_0
58
- - ruby: 2.3.8
58
+ - ruby: 2.3
59
59
  gemfile: rails_6_0
60
- - ruby: 2.4.10
60
+ - ruby: 2.4
61
61
  gemfile: rails_6_0
62
- - ruby: 3.0.0
62
+ - ruby: '3.0'
63
63
  gemfile: rails_6_0
64
64
  - ruby: head
65
65
  gemfile: rails_6_0
66
- - ruby: 2.2.10
66
+ - ruby: 2.2
67
67
  gemfile: rails_6_1
68
- - ruby: 2.3.8
68
+ - ruby: 2.3
69
69
  gemfile: rails_6_1
70
- - ruby: 2.4.10
70
+ - ruby: 2.4
71
71
  gemfile: rails_6_1
72
- - ruby: 2.2.10
72
+ - ruby: 2.2
73
73
  gemfile: rails_head
74
- - ruby: 2.3.8
74
+ - ruby: 2.3
75
75
  gemfile: rails_head
76
- - ruby: 2.4.10
76
+ - ruby: 2.4
77
77
  gemfile: rails_head
78
- - ruby: 2.5.8
78
+ - ruby: 2.5
79
79
  gemfile: rails_head
80
- - ruby: 2.6.6
80
+ - ruby: 2.6
81
81
  gemfile: rails_head
82
- - ruby: 2.7.1
82
+ - ruby: 2.7
83
83
  gemfile: rails_head
84
84
  experimental: false
85
- - ruby: 3.0.0
85
+ - ruby: '3.0'
86
86
  gemfile: rails_head
87
87
  experimental: false
88
88
  include:
89
- - ruby: 2.7.1
89
+ - ruby: 2.7
90
90
  gemfile: rails_head
91
91
  experimental: true
92
- - ruby: 3.0.0
92
+ - ruby: '3.0'
93
93
  gemfile: rails_head
94
94
  experimental: true
95
95
  - ruby: head
data/README.md CHANGED
@@ -110,12 +110,13 @@ json.array! @people, :id, :name
110
110
 
111
111
  To make a plain array without keys, construct and pass in a standard Ruby array.
112
112
 
113
- ``` ruby
113
+ ```ruby
114
114
  my_array = %w(David Jamie)
115
115
 
116
116
  json.people my_array
117
117
 
118
118
  # => "people": [ "David", "Jamie" ]
119
+ ```
119
120
 
120
121
  You don't always have or need a collection when building an array.
121
122
 
@@ -284,13 +285,21 @@ end
284
285
  Aside from that, the `:cached` options on collection rendering is available on Rails >= 6.0. This will cache the
285
286
  rendered results effectively using the multi fetch feature.
286
287
 
287
- ```
288
+ ```ruby
288
289
  json.array! @posts, partial: "posts/post", as: :post, cached: true
289
290
 
290
291
  # or:
291
292
  json.comments @post.comments, partial: "comments/comment", as: :comment, cached: true
292
293
  ```
293
294
 
295
+ If your collection cache depends on multiple sources (try to avoid this to keep things simple), you can name all these dependencies as part of a block that returns an array:
296
+
297
+ ```ruby
298
+ json.array! @posts, partial: "posts/post", as: :post, cached: -> post { [post, current_user] }
299
+ ```
300
+
301
+ This will include both records as part of the cache key and updating either of them will expire the cache.
302
+
294
303
  ## Formatting Keys
295
304
 
296
305
  Keys can be auto formatted using `key_format!`, this can be used to convert
@@ -3,8 +3,8 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rake"
6
- gem "mocha", :require => false
6
+ gem "mocha", require: false
7
7
  gem "appraisal"
8
8
  gem "rails", "~> 6.1.0"
9
9
 
10
- gemspec :path => "../"
10
+ gemspec path: "../"
data/jbuilder.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'jbuilder'
3
- s.version = '2.11.3'
3
+ s.version = '2.11.5'
4
4
  s.authors = 'David Heinemeier Hansson'
5
5
  s.email = 'david@basecamp.com'
6
6
  s.summary = 'Create JSON structures via a Builder-style DSL'
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.required_ruby_version = '>= 2.2.2'
11
11
 
12
12
  s.add_dependency 'activesupport', '>= 5.0.0'
13
+ s.add_dependency 'actionview', '>= 5.0.0'
13
14
 
14
15
  if RUBY_ENGINE == 'rbx'
15
16
  s.add_development_dependency('racc')
@@ -19,4 +20,12 @@ Gem::Specification.new do |s|
19
20
 
20
21
  s.files = `git ls-files`.split("\n")
21
22
  s.test_files = `git ls-files -- test/*`.split("\n")
23
+
24
+ s.metadata = {
25
+ "bug_tracker_uri" => "https://github.com/rails/jbuilder/issues",
26
+ "changelog_uri" => "https://github.com/rails/jbuilder/releases/tag/v#{s.version}",
27
+ "mailing_list_uri" => "https://discuss.rubyonrails.org/c/rubyonrails-talk",
28
+ "source_code_uri" => "https://github.com/rails/jbuilder/tree/v#{s.version}",
29
+ "rubygems_mfa_required" => "true",
30
+ }
22
31
  end
@@ -30,7 +30,7 @@ class <%= controller_class_name %>Controller < ApplicationController
30
30
 
31
31
  respond_to do |format|
32
32
  if @<%= orm_instance.save %>
33
- format.html { redirect_to @<%= singular_table_name %>, notice: <%= %("#{human_name} was successfully created.") %> }
33
+ format.html { redirect_to <%= show_helper %>, notice: <%= %("#{human_name} was successfully created.") %> }
34
34
  format.json { render :show, status: :created, location: <%= "@#{singular_table_name}" %> }
35
35
  else
36
36
  format.html { render :new, status: :unprocessable_entity }
@@ -43,7 +43,7 @@ class <%= controller_class_name %>Controller < ApplicationController
43
43
  def update
44
44
  respond_to do |format|
45
45
  if @<%= orm_instance.update("#{singular_table_name}_params") %>
46
- format.html { redirect_to @<%= singular_table_name %>, notice: <%= %("#{human_name} was successfully updated.") %> }
46
+ format.html { redirect_to <%= show_helper %>, notice: <%= %("#{human_name} was successfully updated.") %> }
47
47
  format.json { render :show, status: :ok, location: <%= "@#{singular_table_name}" %> }
48
48
  else
49
49
  format.html { render :edit, status: :unprocessable_entity }
@@ -55,6 +55,7 @@ class <%= controller_class_name %>Controller < ApplicationController
55
55
  # DELETE <%= route_url %>/1 or <%= route_url %>/1.json
56
56
  def destroy
57
57
  @<%= orm_instance.destroy %>
58
+
58
59
  respond_to do |format|
59
60
  format.html { redirect_to <%= index_helper %>_url, notice: <%= %("#{human_name} was successfully destroyed.") %> }
60
61
  format.json { head :no_content }
@@ -1,5 +1,6 @@
1
1
  require 'delegate'
2
2
  require 'active_support/concern'
3
+ require 'action_view'
3
4
 
4
5
  begin
5
6
  require 'action_view/renderer/collection_renderer'
@@ -141,9 +141,7 @@ class JbuilderTemplate < Jbuilder
141
141
  options.reverse_merge! ::JbuilderTemplate.template_lookup_options
142
142
  as = options[:as]
143
143
 
144
- if options.key?(:collection) && (options[:collection].nil? || options[:collection].empty?)
145
- array!
146
- elsif as && options.key?(:collection) && CollectionRenderer.supported?
144
+ if as && options.key?(:collection) && CollectionRenderer.supported?
147
145
  collection = options.delete(:collection) || []
148
146
  partial = options.delete(:partial)
149
147
  options[:locals].merge!(json: self)
@@ -156,9 +154,11 @@ class JbuilderTemplate < Jbuilder
156
154
  raise ::NotImplementedError, "The `:spacer_template' option is not supported in collection rendering."
157
155
  end
158
156
 
159
- CollectionRenderer
157
+ results = CollectionRenderer
160
158
  .new(@context.lookup_context, options) { |&block| _scope(&block) }
161
159
  .render_collection_with_partial(collection, partial, @context, nil)
160
+
161
+ array! if results.respond_to?(:body) && results.body.nil?
162
162
  elsif as && options.key?(:collection) && !CollectionRenderer.supported?
163
163
  # For Rails <= 5.2:
164
164
  as = as.to_sym
@@ -1,4 +1,4 @@
1
- require 'rails/railtie'
1
+ require 'rails'
2
2
  require 'jbuilder/jbuilder_template'
3
3
 
4
4
  class Jbuilder
data/lib/jbuilder.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'active_support'
1
2
  require 'jbuilder/jbuilder'
2
3
  require 'jbuilder/blank'
3
4
  require 'jbuilder/key_formatter'
@@ -291,6 +291,22 @@ class JbuilderTemplateTest < ActiveSupport::TestCase
291
291
  assert_equal [], result
292
292
  end
293
293
 
294
+ test "works with an enumerable object" do
295
+ enumerable_class = Class.new do
296
+ include Enumerable
297
+ alias length count # Rails 6.1 requires this.
298
+
299
+ def each(&block)
300
+ [].each(&block)
301
+ end
302
+ end
303
+
304
+ result = render('json.array! @posts, partial: "post", as: :post, cached: true', posts: enumerable_class.new)
305
+
306
+ # Do not use #assert_empty as it is important to ensure that the type of the JSON result is an array.
307
+ assert_equal [], result
308
+ end
309
+
294
310
  test "supports the cached: true option" do
295
311
  result = render('json.array! @posts, partial: "post", as: :post, cached: true', posts: POSTS)
296
312
 
@@ -318,6 +334,33 @@ class JbuilderTemplateTest < ActiveSupport::TestCase
318
334
  assert_equal "Pavel", result[5]["author"]["first_name"]
319
335
  end
320
336
 
337
+ test "supports the cached: ->() {} option" do
338
+ result = render('json.array! @posts, partial: "post", as: :post, cached: ->(post) { [post, "foo"] }', posts: POSTS)
339
+
340
+ assert_equal 10, result.count
341
+ assert_equal "Post #5", result[4]["body"]
342
+ assert_equal "Heinemeier Hansson", result[2]["author"]["last_name"]
343
+ assert_equal "Pavel", result[5]["author"]["first_name"]
344
+
345
+ expected = {
346
+ "id" => 1,
347
+ "body" => "Post #1",
348
+ "author" => {
349
+ "first_name" => "David",
350
+ "last_name" => "Heinemeier Hansson"
351
+ }
352
+ }
353
+
354
+ assert_equal expected, Rails.cache.read("post-1/foo")
355
+
356
+ result = render('json.array! @posts, partial: "post", as: :post, cached: ->(post) { [post, "foo"] }', posts: POSTS)
357
+
358
+ assert_equal 10, result.count
359
+ assert_equal "Post #5", result[4]["body"]
360
+ assert_equal "Heinemeier Hansson", result[2]["author"]["last_name"]
361
+ assert_equal "Pavel", result[5]["author"]["first_name"]
362
+ end
363
+
321
364
  test "raises an error on a render call with the :layout option" do
322
365
  error = assert_raises NotImplementedError do
323
366
  render('json.array! @posts, partial: "post", as: :post, layout: "layout"', posts: POSTS)
@@ -31,14 +31,14 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
31
31
  assert_instance_method :create, content do |m|
32
32
  assert_match %r{@post = Post\.new\(post_params\)}, m
33
33
  assert_match %r{@post\.save}, m
34
- assert_match %r{format\.html \{ redirect_to @post, notice: "Post was successfully created\." \}}, m
34
+ assert_match %r{format\.html \{ redirect_to post_url\(@post\), notice: "Post was successfully created\." \}}, m
35
35
  assert_match %r{format\.json \{ render :show, status: :created, location: @post \}}, m
36
36
  assert_match %r{format\.html \{ render :new, status: :unprocessable_entity \}}, m
37
37
  assert_match %r{format\.json \{ render json: @post\.errors, status: :unprocessable_entity \}}, m
38
38
  end
39
39
 
40
40
  assert_instance_method :update, content do |m|
41
- assert_match %r{format\.html \{ redirect_to @post, notice: "Post was successfully updated\." \}}, m
41
+ assert_match %r{format\.html \{ redirect_to post_url\(@post\), notice: "Post was successfully updated\." \}}, m
42
42
  assert_match %r{format\.json \{ render :show, status: :ok, location: @post \}}, m
43
43
  assert_match %r{format\.html \{ render :edit, status: :unprocessable_entity \}}, m
44
44
  assert_match %r{format\.json \{ render json: @post.errors, status: :unprocessable_entity \}}, m
@@ -59,6 +59,25 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
59
59
  end
60
60
  end
61
61
 
62
+ if Rails::VERSION::MAJOR >= 6
63
+ test 'controller with namespace' do
64
+ run_generator %w(Admin::Post --model-name=Post)
65
+ assert_file 'app/controllers/admin/posts_controller.rb' do |content|
66
+ assert_instance_method :create, content do |m|
67
+ assert_match %r{format\.html \{ redirect_to admin_post_url\(@post\), notice: "Post was successfully created\." \}}, m
68
+ end
69
+
70
+ assert_instance_method :update, content do |m|
71
+ assert_match %r{format\.html \{ redirect_to admin_post_url\(@post\), notice: "Post was successfully updated\." \}}, m
72
+ end
73
+
74
+ assert_instance_method :destroy, content do |m|
75
+ assert_match %r{format\.html \{ redirect_to admin_posts_url, notice: "Post was successfully destroyed\." \}}, m
76
+ end
77
+ end
78
+ end
79
+ end
80
+
62
81
  test "don't use require and permit if there are no attributes" do
63
82
  run_generator %w(Post)
64
83
 
data/test/test_helper.rb CHANGED
@@ -1,14 +1,13 @@
1
1
  require "bundler/setup"
2
2
 
3
- require "active_support"
3
+ require "rails"
4
+
5
+ require "jbuilder"
6
+
4
7
  require "active_support/core_ext/array/access"
5
8
  require "active_support/cache/memory_store"
6
9
  require "active_support/json"
7
10
  require "active_model"
8
- require "action_view"
9
- require "rails/version"
10
-
11
- require "jbuilder"
12
11
 
13
12
  require "active_support/testing/autorun"
14
13
  require "mocha/minitest"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.3
4
+ version: 2.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-14 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,7 +24,21 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 5.0.0
27
- description:
27
+ - !ruby/object:Gem::Dependency
28
+ name: actionview
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 5.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 5.0.0
41
+ description:
28
42
  email: david@basecamp.com
29
43
  executables: []
30
44
  extensions: []
@@ -33,7 +47,6 @@ files:
33
47
  - ".github/workflows/ruby.yml"
34
48
  - ".gitignore"
35
49
  - Appraisals
36
- - CHANGELOG.md
37
50
  - CONTRIBUTING.md
38
51
  - Gemfile
39
52
  - MIT-LICENSE
@@ -72,8 +85,13 @@ files:
72
85
  homepage: https://github.com/rails/jbuilder
73
86
  licenses:
74
87
  - MIT
75
- metadata: {}
76
- post_install_message:
88
+ metadata:
89
+ bug_tracker_uri: https://github.com/rails/jbuilder/issues
90
+ changelog_uri: https://github.com/rails/jbuilder/releases/tag/v2.11.5
91
+ mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
92
+ source_code_uri: https://github.com/rails/jbuilder/tree/v2.11.5
93
+ rubygems_mfa_required: 'true'
94
+ post_install_message:
77
95
  rdoc_options: []
78
96
  require_paths:
79
97
  - lib
@@ -88,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
106
  - !ruby/object:Gem::Version
89
107
  version: '0'
90
108
  requirements: []
91
- rubygems_version: 3.2.22
92
- signing_key:
109
+ rubygems_version: 3.2.32
110
+ signing_key:
93
111
  specification_version: 4
94
112
  summary: Create JSON structures via a Builder-style DSL
95
113
  test_files:
data/CHANGELOG.md DELETED
@@ -1,311 +0,0 @@
1
- # Changelog
2
-
3
- 2.11.2
4
- ------
5
-
6
- * [Improve key formatting for nested hashes and disable by default](https://github.com/rails/jbuilder/pull/497)
7
-
8
- 2.11.1
9
- ------
10
-
11
- * Use symbols instead of strings for before_action filters [DHH]
12
- * Slim down comments in generated scaffold code [DHH]
13
-
14
- 2.11.0
15
- ------
16
-
17
- * [Allow jbuilder instance to be passed to #merge!](https://github.com/rails/jbuilder/pull/485)
18
- * [Fix for key_format! when using nested hashes](https://github.com/rails/jbuilder/pull/486)
19
- * [Include rich_text, attachment, and attachments fields in json partial](https://github.com/rails/jbuilder/pull/459)
20
-
21
- 2.10.2
22
- ------
23
-
24
- * Update scaffold generator to use double quotes, 422 form error responds, and modern string-of-arrays syntax [DHH]
25
-
26
- 2.10.1
27
- ------
28
-
29
- * Fix keyword arguments warning on Ruby 2.7
30
-
31
- 2.10.0
32
- ------
33
-
34
- * Requires Rails 5+ and Ruby 2.2+
35
- * Nested hashes are deep-merged
36
-
37
- 2.9.1
38
- -----
39
-
40
- * [Respect JSON encoding customizations](https://github.com/rails/jbuilder/commit/e2e8623b08078ad6a2323ce8ecaf642b7afe1166)
41
-
42
- 2.9.0
43
- -----
44
-
45
- * [Fix passing object with partial without locals](https://github.com/rails/jbuilder/pull/435)
46
- * [Fix deprecation warning in Rails 6.0](https://github.com/rails/jbuilder/pull/453)
47
- * [Use quotes consistently in generated templates](https://github.com/rails/jbuilder/pull/455)
48
- * [Allow omitting timestamps from generated partials](https://github.com/rails/jbuilder/pull/448)
49
- * [Respect changing scaffold generator](https://github.com/rails/jbuilder/pull/458)
50
- * [Use a symbolic default format for Rails 6.0 forward compatibility](https://github.com/rails/jbuilder/commit/3895a7243f3db292b0bf15513fc05494e6e50576)
51
- * [Drop MultiJSON in favor of Ruby standard library JSON](https://github.com/rails/jbuilder/commit/b952ae096eb1828b0fcfde06e6ba62311494ec49)
52
-
53
- 2.8.0
54
- -----
55
-
56
- * [Replace deprecated fragment_cache_key for Rails 5.2 support](https://github.com/rails/jbuilder/pull/430)
57
-
58
- 2.7.0
59
- -----
60
-
61
- * [Requires Rails 4+](https://github.com/rails/jbuilder/commit/5207ff394533177fffdd768bfaa6413a0cd16dc8)
62
- * [Fix implicitly rendering a JSON partial with the same name as an
63
- HTML partial](https://github.com/rails/jbuilder/pull/400)
64
-
65
- 2.6.4
66
- -----
67
-
68
- * Drop the pessimistic upper-bound restriction on Active Support and MultiJSON to prevent future gemfile resolution deadlocks *DHH*
69
-
70
- 2.6.3
71
- -----
72
-
73
- * Support Rails 5.1
74
-
75
- 2.6.2
76
- -----
77
-
78
- * Fix thor warnings
79
-
80
- 2.6.1
81
- -----
82
-
83
- * [Optimize root caches with cache_root!](https://github.com/rails/jbuilder/pull/370)
84
-
85
- 2.6.0
86
- -----
87
-
88
- * [Rails 5 cache! with expire support](https://github.com/rails/jbuilder/commit/d61e3354563863731bc1f358f495b1dbb7ae9d32)
89
- * [Generated view DRYed by using model partial](https://github.com/rails/jbuilder/commit/83256f4d7e9211c9dc47972feaed7fd31e4f7cac)
90
-
91
- 2.5.0
92
- -----
93
-
94
- * [Rails 5 compatibility](https://github.com/rails/jbuilder/commit/64c510ec69d9e63b73ffd5942e802d21a7d14701)
95
-
96
- 2.4.1
97
- -----
98
-
99
- * [Fix controller generators to be Rails 5 compatible](https://github.com/rails/jbuilder/commit/2dc6203c5c4a98701d5b64c2a5200835a48bb533)
100
-
101
- 2.4.0
102
- -----
103
-
104
- * [Rails 5 compatibility](https://github.com/rails/jbuilder/commit/4aa2cfcc19a4634d65a28ffc75f0ac0cb8304115)
105
-
106
- 2.3.2
107
- -----
108
-
109
- * [Remove Mime Types deprecation message](https://github.com/rails/jbuilder/commit/5ba4e4ac654cc8388619538f576fe234659b84ec)
110
-
111
- 2.3.1
112
- -----
113
-
114
- * [Explicitly require ostruct to prevent NameError](https://github.com/rails/jbuilder/pull/281)
115
-
116
- 2.3.0
117
- -----
118
-
119
- * [Add new in-place partial invocation support](https://github.com/rails/jbuilder/commit/1feda7ee605c136e59fb4de970f4674de518e6de)
120
- * [Add implicit partial rendering for AM::Models](https://github.com/rails/jbuilder/commit/4d5bf7d0ea92765adb7be36834e84f9855a061df)
121
- * [Generate API controller if Rails API option is enabled](https://github.com/rails/jbuilder/commit/db68f6bd327cf42b47ef22d455fb5721a8c2cf5f)
122
- * [JBuilder's templates have less priority than app templates](https://github.com/rails/jbuilder/commit/7c1a5f25603ec1f4e51fba3dbba9db23726a5d69)
123
- * [Add AC::Helpers module to jbuilder for api only apps](https://github.com/rails/jbuilder/commit/7cf1d1eb7d125caf38309b5427952030011c1aa0)
124
-
125
- 2.2.16
126
- ------
127
-
128
- * [Fix NoMethodError around `api_only` in railtie](https://github.com/rails/jbuilder/commit/b08d1da10b14720b46d383b2917e336060fd9ffa)
129
-
130
- 2.2.14
131
- ------
132
-
133
- * [Make Jbuilder compatible with Rails API](https://github.com/rails/jbuilder/commit/29c0014a9c954c990075d42c45c66075260e924b)
134
-
135
- 2.2.13
136
- ------
137
-
138
- * Several performance optimizations: [#260](https://github.com/rails/jbuilder/pull/260) & [#261](https://github.com/rails/jbuilder/pull/261)
139
-
140
- 2.2.12
141
- ------
142
-
143
- * [Replace explicit block calls with yield for performance](https://github.com/rails/jbuilder/commit/3184f941276ad03a071cf977133d1a32302afa47)
144
-
145
- 2.2.11
146
- ------
147
-
148
- * Generate the templates for Rails 5+ [#258](https://github.com/rails/jbuilder/pull/258) [@amatsuda](https://github.com/amatsuda)
149
-
150
- 2.2.10
151
- ------
152
-
153
- * Add Jbuilder::Blank#empty? to tell if attributes are empty [#257](https://github.com/rails/jbuilder/pull/257) [@a2ikm](https://github.com/a2ikm)
154
-
155
- 2.2.9
156
- -----
157
-
158
- * Support `partial!` call with `locals` option in `JbuilderTemplate` [#251](https://github.com/rails/jbuilder/pull/251)
159
-
160
- 2.2.8
161
- -----
162
- * [Raise ArrayError when trying to add key to an array](https://github.com/rails/jbuilder/commit/869e4be1ad165ce986d8fca78311bdd3ed166087)
163
-
164
- 2.2.7
165
- -----
166
- * [Make Blank object serializable with Marshal](https://github.com/rails/jbuilder/commit/7083f28d8b665aa60d0d1b1927ae88bb5c6290ba)
167
-
168
- 2.2.6
169
- -----
170
- * [Make sure dependency tracker loads after template handler](https://github.com/rails/jbuilder/commit/3ba404b1207b557e14771c90b8832bc01ae67a42)
171
-
172
- 2.2.5
173
- -----
174
- * [Refactor merge block behavior to raise error for unexpected values](https://github.com/rails/jbuilder/commit/4503162fb26f53f613fc83ac081fd244748b6fe9)
175
-
176
- 2.2.4
177
- -----
178
- * [Typecast locals hash key during collection render](https://github.com/rails/jbuilder/commit/a6b0c8651a08e01cb53eee38e211c65423f275f7)
179
-
180
- 2.2.3
181
- -----
182
- * [Move template handler registration into railtie](https://github.com/rails/jbuilder/commit/c8acc5cea6da2a79b7b345adc301cb5ff2517647)
183
- * [Do not capture the block where it is possible](https://github.com/rails/jbuilder/commit/973b382c3924cb59fc0e4e25266b18e74d41d646)
184
-
185
- 2.2.2
186
- -----
187
- * [Fix `Jbuilder#merge!` inside block](https://github.com/rails/jbuilder/commit/a7b328552eb0d36315f75bff813bea7eecf8c1d7)
188
-
189
- 2.2.1
190
- -----
191
- * [Fix empty block handling](https://github.com/rails/jbuilder/commit/972a11141403269e9b17b45b0c95f8a9788245ee)
192
-
193
- 2.2.0
194
- -----
195
- * [Allow to skip `array!` iterations by calling `next`](https://github.com/rails/jbuilder/commit/81a63308fb9d5002519dd871f829ccc58067251a)
196
-
197
- 2.1.2
198
- -----
199
- * [Cast array-like objects to array before merging](https://github.com/rails/jbuilder/commit/7b8c8a1cb09b7f3dd26e5643ebbd6b2ec67185db)
200
-
201
- 2.1.1
202
- -----
203
- * [Remove unused file](https://github.com/rails/jbuilder/commit/e49e1047976fac93b8242ab212c7b1a463b70809)
204
-
205
- 2.1.0
206
- -----
207
- * [Blocks and their extract! shortcuts are additive by default](https://github.com/rails/jbuilder/commit/a49390736c5f6e2d7a31111df6531bc28dba9fb1)
208
-
209
- 2.0.8
210
- -----
211
- * [Eliminate circular dependencies](https://github.com/rails/jbuilder/commit/0879484dc74e7be93b695f66e3708ba48cdb1be3)
212
- * [Support cache key generation for complex objects](https://github.com/rails/jbuilder/commit/ca9622cca30c1112dd4408fcb2e658849abe1dd5)
213
- * [Remove JbuilderProxy class](https://github.com/rails/jbuilder/commit/5877482fc7da3224e42d4f72a1386f7a3a08173b)
214
- * [Move KeyFormatter into a separate file](https://github.com/rails/jbuilder/commit/13fee8464ff53ce853030114283c03c135c052b6)
215
- * [Move NullError into a separate file](https://github.com/rails/jbuilder/commit/13fee8464ff53ce853030114283c03c135c052b6)
216
-
217
- 2.0.7
218
- -----
219
- * [Add destroy notice to scaffold generator](https://github.com/rails/jbuilder/commit/8448e86f8cdfa0f517bd59576947875775a1d43c)
220
-
221
- 2.0.6
222
- -----
223
- * [Use render short form in controller generator](https://github.com/rails/jbuilder/commit/acf37320a7cea7fcc70c791bc94bd5f46b8349ff)
224
-
225
- 2.0.5
226
- -----
227
- * [Fix edgecase when json is defined as a method](https://github.com/rails/jbuilder/commit/ca711a0c0a5760e26258ce2d93c14bef8fff0ead)
228
-
229
- 2.0.4
230
- -----
231
- * [Add cache_if! to conditionally cache JSON fragments](https://github.com/rails/jbuilder/commit/14a5afd8a2c939a6fd710d355a194c114db96eb2)
232
-
233
- 2.0.3
234
- -----
235
- * [Pass options when calling cache_fragment_name](https://github.com/rails/jbuilder/commit/07c2cc7486fe9ef423d7bc821b83f6d485f330e0)
236
-
237
- 2.0.2
238
- -----
239
- * [Fix Dependency Tracking fail to detect single-quoted partial correctly](https://github.com/rails/jbuilder/commit/448679a6d3098eb34d137f782a05f1767711991a)
240
- * [Prevent Dependency Tracker constants leaking into global namespace](https://github.com/rails/jbuilder/commit/3544b288b63f504f46fa8aafd1d17ee198d77536)
241
-
242
- 2.0.1
243
- -----
244
- * [Dependency tracking support for Rails 3 with cache_digest gem](https://github.com/rails/jbuilder/commit/6b471d7a38118e8f7645abec21955ef793401daf)
245
-
246
- 2.0.0
247
- -----
248
- * [Respond to PUT/PATCH API request with :ok](https://github.com/rails/jbuilder/commit/9dbce9c12181e89f8f472ac23c764ffe8438040a)
249
- * [Remove Ruby 1.8 support](https://github.com/rails/jbuilder/commit/d53fff42d91f33d662eafc2561c4236687ecf6c9)
250
- * [Remove deprecated two argument block call](https://github.com/rails/jbuilder/commit/07a35ee7e79ae4b06dba9dbff5c4e07c1e627218)
251
- * [Make Jbuilder object initialize with single hash](https://github.com/rails/jbuilder/commit/38bf551db0189327aaa90b9be010c0d1b792c007)
252
- * [Track template dependencies](https://github.com/rails/jbuilder/commit/8e73cea39f60da1384afd687cc8e5e399630d8cc)
253
- * [Expose merge! method](https://github.com/rails/jbuilder/commit/0e2eb47f6f3c01add06a1a59b37cdda8baf24f29)
254
-
255
- 1.5.3
256
- -----
257
- * [Generators add `:id` column by default](https://github.com/rails/jbuilder/commit/0b52b86773e48ac2ce35d4155c7b70ad8b3e8937)
258
-
259
- 1.5.2
260
- -----
261
- * [Nil-collection should be treated as empty array](https://github.com/rails/jbuilder/commit/2f700bb00ab663c6b7fcb28d2967aeb989bd43c7)
262
-
263
- 1.5.1
264
- -----
265
- * [Expose template lookup options](https://github.com/rails/jbuilder/commit/404c18dee1af96ac6d8052a04062629ef1db2945)
266
-
267
- 1.5.0
268
- -----
269
- * [Do not perform any caching when `controller.perform_caching` is false](https://github.com/rails/jbuilder/commit/94633facde1ac43580f8cd5e13ae9cc83e1da8f4)
270
- * [Add partial collection rendering](https://github.com/rails/jbuilder/commit/e8c10fc885e41b18178aaf4dcbc176961c928d76)
271
- * [Deprecate extract! calling private methods](https://github.com/rails/jbuilder/commit/b9e19536c2105d7f2e813006bbcb8ca5730d28a3)
272
- * [Add array of partials rendering](https://github.com/rails/jbuilder/commit/7d7311071720548047f98f14ad013c560b8d9c3a)
273
-
274
- 1.4.2
275
- -----
276
- * [Require MIME dependency explicitly](https://github.com/rails/jbuilder/commit/b1ed5ac4f08b056f8839b4b19b43562e81e02a59)
277
-
278
- 1.4.1
279
- -----
280
- * [Removed deprecated positioned arguments initializer support](https://github.com/rails/jbuilder/commit/6e03e0452073eeda77e6dfe66aa31e5ec67a3531)
281
- * [Deprecate two-arguments block calling](https://github.com/rails/jbuilder/commit/2b10bb058bb12bc782cbcc16f6ec67b489e5ed43)
282
-
283
- 1.4.0
284
- -----
285
- * [Add quick collection attribute extraction](https://github.com/rails/jbuilder/commit/c2b966cf653ea4264fbb008b8cc6ce5359ebe40a)
286
- * [Block has priority over attributes extraction](https://github.com/rails/jbuilder/commit/77c24766362c02769d81dac000b1879a9e4d4a00)
287
- * [Meaningful error messages when adding properties to null](https://github.com/rails/jbuilder/commit/e26764602e34b3772e57e730763d512e59489e3b)
288
- * [Do not enforce template format, enforce handlers instead](https://github.com/rails/jbuilder/commit/72576755224b15da45e50cbea877679800ab1398)
289
-
290
- 1.3.0
291
- -----
292
- * [Add nil! method for nil JSON](https://github.com/rails/jbuilder/commit/822a906f68664f61a1209336bb681077692c8475)
293
-
294
- 1.2.1
295
- -----
296
- * [Added explicit dependency for MultiJson](https://github.com/rails/jbuilder/commit/4d58eacb6cd613679fb243484ff73a79bbbff2d2)
297
-
298
- 1.2.0
299
- -----
300
- * Multiple documentation improvements and internal refactoring
301
- * [Fixes fragment caching to work with latest digests](https://github.com/rails/jbuilder/commit/da937d6b8732124074c612abb7ff38868d1d96c0)
302
-
303
- 1.0.2
304
- -----
305
- * [Support non-Enumerable collections](https://github.com/rails/jbuilder/commit/4c20c59bf8131a1e419bb4ebf84f2b6bdcb6b0cf)
306
- * [Ensure that the default URL is in json format](https://github.com/rails/jbuilder/commit/0b46782fb7b8c34a3c96afa801fe27a5a97118a4)
307
-
308
- 1.0.0
309
- -----
310
- * Adopt Semantic Versioning
311
- * Add rails generators