actionview 5.0.0.1 → 5.0.1.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionview might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eef6f68f50be30f192b6db928ae5bae09efa6471
4
- data.tar.gz: 538a821d9fcfc3d4f3caf44394120b5dadd0ecec
3
+ metadata.gz: 72d354dd1600d2bd3a6b748947dc6e5178c930e0
4
+ data.tar.gz: 86768dbfffe647ce3b7161bb6fec7f4e8aaae67d
5
5
  SHA512:
6
- metadata.gz: eee6abcea24bea2ceeb02d90831600aca3c152468fcd8ee2a57422458238ccf0cc8ad02f357620a896ed4070bf978c726cc61eef63cbfb7dd63c7c069ea6131d
7
- data.tar.gz: 838399475575bde9589e8801461392cab0d733e98e13250e7819bc39755766635c7f963dd928199aea1e4e3eb74a52ab9cd2b2ff6699813eef110d7a06616965
6
+ metadata.gz: a966cb46db779ce5bcffc2f83d7770036ed6752dbfe0dbf497bdc971e0fcf70c91abcdc0e554bf6fc5c0166bb4e2f29b3363785dd88bdb17568ec559bbf15fa3
7
+ data.tar.gz: 540ba24650be60525c4bf012418a925cc3c0b37a759c0a634d403d7eb096643a7f1518a3ba452a19f9759b3dd42dd094c12d6745d06b19df980c2313aabbf893
data/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
+ ## Rails 5.0.1.rc1 (December 01, 2016) ##
2
+
3
+ * Fix support to `ActionController::Parameters` in `button_to`.
4
+
5
+ *Jon Moss*
6
+
7
+ * Render now accepts any keys for locals, including reserved words
8
+
9
+ Only locals with valid variable names get set directly. Others
10
+ will still be available in local_assigns.
11
+
12
+ Example of render with reserved words:
13
+
14
+ ```erb
15
+ <%= render "example", class: "text-center", message: "Hello world!" %>
16
+
17
+ <!-- _example.html.erb: -->
18
+ <%= tag.div class: local_assigns[:class] do %>
19
+ <p><%= message %></p>
20
+ <% end %>
21
+ ```
22
+
23
+ *Peter Schilling*, *Matthew Draper*
24
+
25
+ * Changed partial rendering with a collection to allow collections which
26
+ implement `to_a`.
27
+
28
+ Extracting the collection option had an optimization to avoid unnecessary
29
+ queries of ActiveRecord Relations by calling `#to_ary` on the given
30
+ collection. Instances of `Enumerator` or `Enumerable` are valid
31
+ collections, but they do not implement `#to_ary`. By changing this to
32
+ `#to_a`, they will now be extracted and rendered as expected.
33
+
34
+ *Steven Harman*
35
+
36
+ * Fix `ActionView::Helpers#current_page?` to work properly even with
37
+ a trailing slash.
38
+
39
+ Fixes #19472.
40
+
41
+ *Stan Lo*
42
+
43
+
1
44
  ## Rails 5.0.0 (June 30, 2016) ##
2
45
 
46
+ * Changed partial rendering with a collection to allow collections which
47
+ implement `to_a`.
48
+
49
+ Extracting the collection option had an optimization to avoid unnecessary
50
+ queries of ActiveRecord Relations by calling `#to_ary` on the given
51
+ collection. Instances of `Enumerator` or `Enumerable` are valid
52
+ collections, but they do not implement `#to_ary`. By changing this to
53
+ `#to_a`, they will now be extracted and rendered as expected.
54
+
55
+ *Steven Harman*
56
+
3
57
  * Change `datetime_field` and `datetime_field_tag` to generate `datetime-local` fields.
4
58
 
5
59
  As a new specification of the HTML 5 the text field type `datetime` will no longer exist
@@ -292,7 +346,7 @@
292
346
 
293
347
  *Todd Bealmear*
294
348
 
295
- * Allow to pass a string value to `size` option in `image_tag` and `video_tag`.
349
+ * Allow to pass an integer value to `size` option in `image_tag` and `video_tag`.
296
350
 
297
351
  This makes the behavior more consistent with `width` or `height` options.
298
352
 
data/README.rdoc CHANGED
@@ -13,7 +13,7 @@ The latest version of Action View can be installed with RubyGems:
13
13
 
14
14
  Source code can be downloaded as part of the Rails project on GitHub
15
15
 
16
- * https://github.com/rails/rails/tree/master/actionview
16
+ * https://github.com/rails/rails/tree/5-0-stable/actionview
17
17
 
18
18
 
19
19
  == License
@@ -6,6 +6,12 @@ module ActionView
6
6
  class Digestor
7
7
  @@digest_mutex = Mutex.new
8
8
 
9
+ module PerExecutionDigestCacheExpiry
10
+ def self.before(target)
11
+ ActionView::LookupContext::DetailsKey.clear
12
+ end
13
+ end
14
+
9
15
  class << self
10
16
  # Supported options:
11
17
  #
@@ -42,8 +48,7 @@ module ActionView
42
48
  options = {}
43
49
  options[:formats] = [finder.rendered_format] if finder.rendered_format
44
50
 
45
- if finder.disable_cache { finder.exists?(logical_name, [], partial, [], options) }
46
- template = finder.disable_cache { finder.find(logical_name, [], partial, [], options) }
51
+ if template = finder.disable_cache { finder.find_all(logical_name, [], partial, [], options).first }
47
52
  finder.rendered_format ||= template.formats.first
48
53
 
49
54
  if node = seen[template.identifier] # handle cycles in the tree
@@ -7,8 +7,8 @@ module ActionView
7
7
  module VERSION
8
8
  MAJOR = 5
9
9
  MINOR = 0
10
- TINY = 0
11
- PRE = "1"
10
+ TINY = 1
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -187,9 +187,9 @@ module ActionView
187
187
  if value.is_a?(Array)
188
188
  value = escape ? safe_join(value, " ".freeze) : value.join(" ".freeze)
189
189
  else
190
- value = escape ? ERB::Util.unwrapped_html_escape(value) : value
190
+ value = escape ? ERB::Util.unwrapped_html_escape(value) : value.to_s
191
191
  end
192
- %(#{key}="#{value.gsub(/"/, '&quot;'.freeze)}")
192
+ %(#{key}="#{value.gsub('"'.freeze, '&quot;'.freeze)}")
193
193
  end
194
194
  end
195
195
  end
@@ -225,14 +225,7 @@ module ActionView
225
225
  #
226
226
  # pluralize(2, 'Person', locale: :de)
227
227
  # # => 2 Personen
228
- def pluralize(count, singular, deprecated_plural = nil, plural: nil, locale: I18n.locale)
229
- if deprecated_plural
230
- ActiveSupport::Deprecation.warn("Passing plural as a positional argument " \
231
- "is deprecated and will be removed in Rails 5.1. Use e.g. " \
232
- "pluralize(1, 'person', plural: 'people') instead.")
233
- plural ||= deprecated_plural
234
- end
235
-
228
+ def pluralize(count, singular, plural_arg = nil, plural: plural_arg, locale: I18n.locale)
236
229
  word = if (count == 1 || count =~ /^1(\.0+)?$/)
237
230
  singular
238
231
  else
@@ -548,6 +548,8 @@ module ActionView
548
548
  request_uri = url_string.index("?") ? request.fullpath : request.path
549
549
  request_uri = URI.parser.unescape(request_uri).force_encoding(Encoding::BINARY)
550
550
 
551
+ url_string.chomp!("/") if url_string.start_with?("/") && url_string != "/"
552
+
551
553
  if url_string =~ /^\w+:\/\//
552
554
  url_string == "#{request.protocol}#{request.host_with_port}#{request_uri}"
553
555
  else
@@ -614,6 +616,17 @@ module ActionView
614
616
  # to_form_params({ name: 'Denmark' }, 'country')
615
617
  # # => [{name: 'country[name]', value: 'Denmark'}]
616
618
  def to_form_params(attribute, namespace = nil) # :nodoc:
619
+ attribute = if attribute.respond_to?(:permitted?)
620
+ unless attribute.permitted?
621
+ raise ArgumentError, "Attempting to generate a buttom from non-sanitized request parameters!" \
622
+ " Whitelist and sanitize passed parameters to be secure."
623
+ end
624
+
625
+ attribute.to_h
626
+ else
627
+ attribute
628
+ end
629
+
617
630
  params = []
618
631
  case attribute
619
632
  when Hash
@@ -40,7 +40,7 @@ module ActionView
40
40
  initializer "action_view.per_request_digest_cache" do |app|
41
41
  ActiveSupport.on_load(:action_view) do
42
42
  if app.config.consider_all_requests_local
43
- app.executor.to_run { ActionView::LookupContext::DetailsKey.clear }
43
+ app.executor.to_run ActionView::Digestor::PerExecutionDigestCacheExpiry
44
44
  end
45
45
  end
46
46
  end
@@ -403,7 +403,7 @@ module ActionView
403
403
  def collection_from_options
404
404
  if @options.key?(:collection)
405
405
  collection = @options[:collection]
406
- collection.respond_to?(:to_ary) ? collection.to_ary : []
406
+ collection ? collection.to_a : []
407
407
  end
408
408
  end
409
409
 
@@ -1,6 +1,7 @@
1
- require 'active_support/core_ext/object/try'
2
- require 'active_support/core_ext/kernel/singleton_class'
3
- require 'thread'
1
+ require "active_support/core_ext/object/try"
2
+ require "active_support/core_ext/kernel/singleton_class"
3
+ require "active_support/core_ext/module/delegation"
4
+ require "thread"
4
5
 
5
6
  module ActionView
6
7
  # = Action View Template
@@ -325,8 +326,13 @@ module ActionView
325
326
  end
326
327
 
327
328
  def locals_code #:nodoc:
329
+ # Only locals with valid variable names get set directly. Others will
330
+ # still be available in local_assigns.
331
+ locals = @locals.to_set - Module::DELEGATION_RESERVED_METHOD_NAMES
332
+ locals = locals.grep(/\A(?![A-Z0-9])(?:[[:alnum:]_]|[^\0-\177])+\z/)
333
+
328
334
  # Double assign to suppress the dreaded 'assigned but unused variable' warning
329
- @locals.each_with_object('') { |key, code| code << "#{key} = #{key} = local_assigns[:#{key}];" }
335
+ locals.each_with_object("") { |key, code| code << "#{key} = #{key} = local_assigns[:#{key}];" }
330
336
  end
331
337
 
332
338
  def method_name #:nodoc:
@@ -153,6 +153,7 @@ module ActionView
153
153
 
154
154
  included do
155
155
  setup :setup_with_controller
156
+ ActiveSupport.run_load_hooks(:action_view_test_case, self)
156
157
  end
157
158
 
158
159
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.1
4
+ version: 5.0.1.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-10 00:00:00.000000000 Z
11
+ date: 2016-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.0.1
19
+ version: 5.0.1.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.0.0.1
26
+ version: 5.0.1.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 5.0.0.1
95
+ version: 5.0.1.rc1
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 5.0.0.1
102
+ version: 5.0.1.rc1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: activemodel
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 5.0.0.1
109
+ version: 5.0.1.rc1
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 5.0.0.1
116
+ version: 5.0.1.rc1
117
117
  description: Simple, battle-tested conventions and helpers for building web pages.
118
118
  email: david@loudthinking.com
119
119
  executables: []
@@ -238,15 +238,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
238
238
  version: 2.2.2
239
239
  required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - ">="
241
+ - - ">"
242
242
  - !ruby/object:Gem::Version
243
- version: '0'
243
+ version: 1.3.1
244
244
  requirements:
245
245
  - none
246
246
  rubyforge_project:
247
- rubygems_version: 2.6.6
247
+ rubygems_version: 2.5.2
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: Rendering framework putting the V in MVC (part of Rails).
251
251
  test_files: []
252
- has_rdoc: