jbuilder 2.4.0 → 2.4.1

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: 0d81b1f225c9a1a5434a32b5860caf0c700fc84d
4
- data.tar.gz: ae62a5c52ee9a478edbbed2e932c6909430c1959
3
+ metadata.gz: 2772c97d74b0d758e3c0d5ea5f9a3b4c6e183ca2
4
+ data.tar.gz: 90cd6541479870d8f980c16efb259610a8f3c84e
5
5
  SHA512:
6
- metadata.gz: 5623f106449739cdf61722fd4e29953d639290e49b055a3f41a05bbe2db23b7ac82cef05a19ef7d7b04cdb3bab1f7fbaafb3381b21955914ad64443e62daef03
7
- data.tar.gz: fa4e9acff1b741491f768fca5aaef394068fc82dee66e98bac904bdeec3d99dc4c1cada77917d36fd0981e0f43a74eaedc9371ba2cde0cab7d3c4f54e26a16b7
6
+ metadata.gz: ccb161cc31da1151f75abb7d28d9c3c0fcb66945d22ebe6e93442cc2aa6b3be8e95eb53067d6f546ff86f05efa1de304b96b2afeed4424a998b8d52e5285886f
7
+ data.tar.gz: a2e3d859a9a5fb8909cdfe085f99f9881c2ca24da64c906d804cb7714ad636512e4de12e8a970f9dcf159c7394f9bc2db6f7be90886b5877bd1b5d4f5bb9dc27
data/Appraisals CHANGED
@@ -38,7 +38,7 @@ appraise "rails-4-2" do
38
38
  end
39
39
 
40
40
  appraise "rails-5-0" do
41
- gem "railties", ">= 5.0.0.beta1", "< 5.1"
42
- gem "actionpack", ">= 5.0.0.beta1", "< 5.1"
43
- gem "activemodel", ">= 5.0.0.beta1", "< 5.1"
41
+ gem "railties", ">= 5.0.0.beta2", "< 5.1"
42
+ gem "actionpack", ">= 5.0.0.beta2", "< 5.1"
43
+ gem "activemodel", ">= 5.0.0.beta2", "< 5.1"
44
44
  end
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ 2.4.1
4
+ -----
5
+
6
+ * [Fix controller generators to be Rails 5 compatible](https://github.com/rails/jbuilder/commit/2dc6203c5c4a98701d5b64c2a5200835a48bb533)
7
+
8
+ 2.4.0
9
+ -----
10
+
11
+ * [Rails 5 compatibility](https://github.com/rails/jbuilder/commit/4aa2cfcc19a4634d65a28ffc75f0ac0cb8304115)
12
+
3
13
  2.3.2
4
14
  -----
5
15
 
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2015 David Heinemeier Hansson, 37signals
1
+ Copyright (c) 2011-2016 David Heinemeier Hansson, 37signals
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -6,8 +6,8 @@ gem "rake"
6
6
  gem "mocha", :require => false
7
7
  gem "appraisal"
8
8
  gem "pry"
9
- gem "railties", ">= 5.0.0.beta1", "< 5.1"
10
- gem "actionpack", ">= 5.0.0.beta1", "< 5.1"
11
- gem "activemodel", ">= 5.0.0.beta1", "< 5.1"
9
+ gem "railties", ">= 5.0.0.beta2", "< 5.1"
10
+ gem "actionpack", ">= 5.0.0.beta2", "< 5.1"
11
+ gem "activemodel", ">= 5.0.0.beta2", "< 5.1"
12
12
 
13
13
  gemspec :path => "../"
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'jbuilder'
3
- s.version = '2.4.0'
3
+ s.version = '2.4.1'
4
4
  s.authors = ['David Heinemeier Hansson', 'Pavel Pravosud']
5
5
  s.email = ['david@37signals.com', 'pavel@pravosud.com']
6
6
  s.summary = 'Create JSON structures via a Builder-style DSL'
@@ -54,7 +54,7 @@ class <%= controller_class_name %>Controller < ApplicationController
54
54
  # Never trust parameters from the scary internet, only allow the white list through.
55
55
  def <%= "#{singular_table_name}_params" %>
56
56
  <%- if attributes_names.empty? -%>
57
- params[<%= ":#{singular_table_name}" %>]
57
+ params.fetch(<%= ":#{singular_table_name}" %>, {})
58
58
  <%- else -%>
59
59
  params.require(<%= ":#{singular_table_name}" %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
60
60
  <%- end -%>
@@ -75,7 +75,7 @@ class <%= controller_class_name %>Controller < ApplicationController
75
75
  # Never trust parameters from the scary internet, only allow the white list through.
76
76
  def <%= "#{singular_table_name}_params" %>
77
77
  <%- if attributes_names.empty? -%>
78
- params[<%= ":#{singular_table_name}" %>]
78
+ params.fetch(<%= ":#{singular_table_name}" %>, {})
79
79
  <%- else -%>
80
80
  params.require(<%= ":#{singular_table_name}" %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
81
81
  <%- end -%>
@@ -42,5 +42,14 @@ if Rails::VERSION::MAJOR > 4
42
42
  assert_match(/params\.require\(:post\)\.permit\(:title, :body\)/, content)
43
43
  end
44
44
  end
45
+
46
+ test 'dont use require and permit if there are no attributes' do
47
+ run_generator %w(Post --api)
48
+
49
+ assert_file 'app/controllers/posts_controller.rb' do |content|
50
+ assert_match(/def post_params/, content)
51
+ assert_match(/params\.fetch\(:post, {}\)/, content)
52
+ end
53
+ end
45
54
  end
46
55
  end
@@ -54,4 +54,13 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
54
54
  assert_match(/params\.require\(:post\)\.permit\(:title, :body\)/, content)
55
55
  end
56
56
  end
57
+
58
+ test 'dont use require and permit if there are no attributes' do
59
+ run_generator %w(Post)
60
+
61
+ assert_file 'app/controllers/posts_controller.rb' do |content|
62
+ assert_match(/def post_params/, content)
63
+ assert_match(/params\.fetch\(:post, {}\)/, content)
64
+ end
65
+ end
57
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-27 00:00:00.000000000 Z
12
+ date: 2016-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -69,7 +69,6 @@ files:
69
69
  - gemfiles/rails_4_1.gemfile
70
70
  - gemfiles/rails_4_2.gemfile
71
71
  - gemfiles/rails_5_0.gemfile
72
- - gemfiles/rails_edge.gemfile
73
72
  - jbuilder.gemspec
74
73
  - lib/generators/rails/jbuilder_generator.rb
75
74
  - lib/generators/rails/scaffold_controller_generator.rb
@@ -1,13 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rake"
6
- gem "mocha", :require => false
7
- gem "appraisal"
8
- gem "pry"
9
- gem "rails", ">= 5.0.0.alpha", :github => "rails/rails"
10
- gem "arel", ">= 7.0.0.alpha", :github => "rails/arel"
11
- gem "rack", ">= 2.0.0.alpha", :github => "rack/rack"
12
-
13
- gemspec :path => "../"