actionpack 3.2.3.rc1 → 3.2.3.rc2

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

Potentially problematic release.


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

@@ -1,5 +1,11 @@
1
1
  ## Rails 3.2.3 (unreleased) ##
2
2
 
3
+ * Fix #5632, render :inline set the proper rendered format. *Santiago Pastorino*
4
+
5
+ * Fix textarea rendering when using plugins like HAML. Such plugins encode the first newline character in the content. This issue was introduced in https://github.com/rails/rails/pull/5191 *James Coleman*
6
+
7
+ * Add `config.action_view.embed_authenticity_token_in_remote_forms` (defaults to true) which allows to set if authenticity token will be included by default in remote forms. If you change it to false, you can still force authenticity token by passing `:authenticity_token => true` in form options *Piotr Sarnacki*
8
+
3
9
  * Do not include the authenticity token in forms where remote: true as ajax forms use the meta-tag value *DHH*
4
10
 
5
11
  * Turn off verbose mode of rack-cache, we still have X-Rack-Cache to
@@ -3,7 +3,7 @@ module ActionPack
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
5
  TINY = 3
6
- PRE = "rc1"
6
+ PRE = "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
@@ -1072,7 +1072,7 @@ module ActionView
1072
1072
  options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split)
1073
1073
  end
1074
1074
 
1075
- content_tag("textarea", "\n#{options.delete('value') || value_before_type_cast(object)}", options)
1075
+ content_tag("textarea", options.delete('value') || value_before_type_cast(object), options)
1076
1076
  end
1077
1077
 
1078
1078
  def to_check_box_tag(options = {}, checked_value = "1", unchecked_value = "0")
@@ -2,6 +2,7 @@ require 'cgi'
2
2
  require 'action_view/helpers/tag_helper'
3
3
  require 'active_support/core_ext/object/blank'
4
4
  require 'active_support/core_ext/string/output_safety'
5
+ require 'active_support/core_ext/module/attribute_accessors'
5
6
 
6
7
  module ActionView
7
8
  # = Action View Form Tag Helpers
@@ -17,6 +18,9 @@ module ActionView
17
18
  include UrlHelper
18
19
  include TextHelper
19
20
 
21
+ mattr_accessor :embed_authenticity_token_in_remote_forms
22
+ self.embed_authenticity_token_in_remote_forms = true
23
+
20
24
  # Starts a form tag that points the action to an url configured with <tt>url_for_options</tt> just like
21
25
  # ActionController::Base#url_for. The method for the form defaults to POST.
22
26
  #
@@ -27,9 +31,11 @@ module ActionView
27
31
  # is added to simulate the verb over post.
28
32
  # * <tt>:authenticity_token</tt> - Authenticity token to use in the form. Use only if you need to
29
33
  # pass custom authenticity token string, or to not add authenticity_token field at all
30
- # (by passing <tt>false</tt>). If this is a remote form, the authenticity_token will by default
31
- # not be included as the ajax handler will get it from the meta-tag (but you can force it to be
32
- # rendered anyway in that case by passing <tt>true</tt>).
34
+ # (by passing <tt>false</tt>). Remote forms may omit the embedded authenticity token
35
+ # by setting <tt>config.action_view.embed_authenticity_token_in_remote_forms = false</tt>.
36
+ # This is helpful when you're fragment-caching the form. Remote forms get the
37
+ # authenticity from the <tt>meta</tt> tag, so embedding is unnecessary unless you
38
+ # support browsers without JavaScript.
33
39
  # * A list of parameters to feed to the URL the form will be posted to.
34
40
  # * <tt>:remote</tt> - If set to true, will allow the Unobtrusive JavaScript drivers to control the
35
41
  # submit behavior. By default this behavior is an ajax submit.
@@ -611,16 +617,18 @@ module ActionView
611
617
  # responsibility of the caller to escape all the values.
612
618
  html_options["action"] = url_for(url_for_options)
613
619
  html_options["accept-charset"] = "UTF-8"
614
-
620
+
615
621
  html_options["data-remote"] = true if html_options.delete("remote")
616
622
 
617
- if html_options["data-remote"] && html_options["authenticity_token"] == true
623
+ if html_options["data-remote"] &&
624
+ !embed_authenticity_token_in_remote_forms &&
625
+ html_options["authenticity_token"].blank?
626
+ # The authenticity token is taken from the meta tag in this case
627
+ html_options["authenticity_token"] = false
628
+ elsif html_options["authenticity_token"] == true
618
629
  # Include the default authenticity_token, which is only generated when its set to nil,
619
630
  # but we needed the true value to override the default of no authenticity_token on data-remote.
620
631
  html_options["authenticity_token"] = nil
621
- elsif html_options["data-remote"]
622
- # The authenticity token is taken from the meta tag in this case
623
- html_options["authenticity_token"] = false
624
632
  end
625
633
  end
626
634
  end
@@ -17,6 +17,10 @@ module ActionView
17
17
  autofocus novalidate formnovalidate open pubdate).to_set
18
18
  BOOLEAN_ATTRIBUTES.merge(BOOLEAN_ATTRIBUTES.map {|attribute| attribute.to_sym })
19
19
 
20
+ PRE_CONTENT_STRINGS = {
21
+ :textarea => "\n"
22
+ }
23
+
20
24
  # Returns an empty HTML tag of type +name+ which by default is XHTML
21
25
  # compliant. Set +open+ to true to create an open tag compatible
22
26
  # with HTML 4.0 and below. Add HTML attributes by passing an attributes
@@ -125,7 +129,7 @@ module ActionView
125
129
 
126
130
  def content_tag_string(name, content, options, escape = true)
127
131
  tag_options = tag_options(options, escape) if options
128
- "<#{name}#{tag_options}>#{escape ? ERB::Util.h(content) : content}</#{name}>".html_safe
132
+ "<#{name}#{tag_options}>#{PRE_CONTENT_STRINGS[name.to_sym]}#{escape ? ERB::Util.h(content) : content}</#{name}>".html_safe
129
133
  end
130
134
 
131
135
  def tag_options(options, escape = true)
@@ -7,6 +7,14 @@ module ActionView
7
7
  config.action_view = ActiveSupport::OrderedOptions.new
8
8
  config.action_view.stylesheet_expansions = {}
9
9
  config.action_view.javascript_expansions = { :defaults => %w(jquery jquery_ujs) }
10
+ config.action_view.embed_authenticity_token_in_remote_forms = true
11
+
12
+ initializer "action_view.embed_authenticity_token_in_remote_forms" do |app|
13
+ ActiveSupport.on_load(:action_view) do
14
+ ActionView::Helpers::FormTagHelper.embed_authenticity_token_in_remote_forms =
15
+ app.config.action_view.delete(:embed_authenticity_token_in_remote_forms)
16
+ end
17
+ end
10
18
 
11
19
  initializer "action_view.cache_asset_ids" do |app|
12
20
  unless app.config.cache_classes
@@ -11,8 +11,8 @@ module ActionView
11
11
  context = @lookup_context
12
12
 
13
13
  unless context.rendered_format
14
- context.rendered_format = template.formats.first
15
- context.formats = template.formats
14
+ context.formats = template.formats unless template.formats.empty?
15
+ context.rendered_format = context.formats.first
16
16
  end
17
17
 
18
18
  render_template(template, options[:layout], options[:locals])
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424079
4
+ hash: 15424073
5
5
  prerelease: true
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
9
  - 3
10
10
  - rc
11
- - 1
12
- version: 3.2.3.rc1
11
+ - 2
12
+ version: 3.2.3.rc2
13
13
  platform: ruby
14
14
  authors:
15
15
  - David Heinemeier Hansson
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-03-27 00:00:00 -03:00
20
+ date: 2012-03-29 00:00:00 -03:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -26,14 +26,14 @@ dependencies:
26
26
  requirements:
27
27
  - - "="
28
28
  - !ruby/object:Gem::Version
29
- hash: 15424079
29
+ hash: 15424073
30
30
  segments:
31
31
  - 3
32
32
  - 2
33
33
  - 3
34
34
  - rc
35
- - 1
36
- version: 3.2.3.rc1
35
+ - 2
36
+ version: 3.2.3.rc2
37
37
  requirement: *id001
38
38
  type: :runtime
39
39
  name: activesupport
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "="
46
46
  - !ruby/object:Gem::Version
47
- hash: 15424079
47
+ hash: 15424073
48
48
  segments:
49
49
  - 3
50
50
  - 2
51
51
  - 3
52
52
  - rc
53
- - 1
54
- version: 3.2.3.rc1
53
+ - 2
54
+ version: 3.2.3.rc2
55
55
  requirement: *id002
56
56
  type: :runtime
57
57
  name: activemodel