actionview 4.1.16 → 4.2.0.beta1

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.

Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +85 -483
  3. data/README.rdoc +7 -2
  4. data/lib/action_view.rb +0 -1
  5. data/lib/action_view/base.rb +2 -10
  6. data/lib/action_view/digestor.rb +1 -1
  7. data/lib/action_view/gem_version.rb +3 -3
  8. data/lib/action_view/helpers/asset_tag_helper.rb +32 -25
  9. data/lib/action_view/helpers/asset_url_helper.rb +29 -18
  10. data/lib/action_view/helpers/cache_helper.rb +2 -2
  11. data/lib/action_view/helpers/capture_helper.rb +1 -12
  12. data/lib/action_view/helpers/date_helper.rb +16 -12
  13. data/lib/action_view/helpers/debug_helper.rb +7 -11
  14. data/lib/action_view/helpers/form_helper.rb +65 -13
  15. data/lib/action_view/helpers/form_options_helper.rb +3 -3
  16. data/lib/action_view/helpers/form_tag_helper.rb +137 -28
  17. data/lib/action_view/helpers/javascript_helper.rb +7 -1
  18. data/lib/action_view/helpers/number_helper.rb +8 -10
  19. data/lib/action_view/helpers/output_safety_helper.rb +6 -6
  20. data/lib/action_view/helpers/rendering_helper.rb +6 -6
  21. data/lib/action_view/helpers/sanitize_helper.rb +67 -109
  22. data/lib/action_view/helpers/tag_helper.rb +15 -5
  23. data/lib/action_view/helpers/tags/base.rb +1 -1
  24. data/lib/action_view/helpers/tags/collection_check_boxes.rb +5 -1
  25. data/lib/action_view/helpers/tags/collection_helpers.rb +1 -1
  26. data/lib/action_view/helpers/tags/datetime_field.rb +10 -2
  27. data/lib/action_view/helpers/tags/label.rb +3 -3
  28. data/lib/action_view/helpers/tags/placeholderable.rb +32 -0
  29. data/lib/action_view/helpers/tags/text_area.rb +4 -0
  30. data/lib/action_view/helpers/tags/text_field.rb +4 -1
  31. data/lib/action_view/helpers/tags/week_field.rb +1 -1
  32. data/lib/action_view/helpers/text_helper.rb +25 -8
  33. data/lib/action_view/helpers/translation_helper.rb +29 -25
  34. data/lib/action_view/helpers/url_helper.rb +13 -14
  35. data/lib/action_view/log_subscriber.rb +5 -5
  36. data/lib/action_view/lookup_context.rb +6 -12
  37. data/lib/action_view/model_naming.rb +1 -1
  38. data/lib/action_view/path_set.rb +7 -19
  39. data/lib/action_view/renderer/abstract_renderer.rb +5 -3
  40. data/lib/action_view/renderer/partial_renderer.rb +76 -38
  41. data/lib/action_view/renderer/renderer.rb +0 -4
  42. data/lib/action_view/renderer/template_renderer.rb +5 -6
  43. data/lib/action_view/rendering.rb +7 -6
  44. data/lib/action_view/routing_url_for.rb +13 -5
  45. data/lib/action_view/tasks/dependencies.rake +7 -9
  46. data/lib/action_view/template/handlers.rb +9 -0
  47. data/lib/action_view/template/resolver.rb +7 -24
  48. data/lib/action_view/test_case.rb +13 -7
  49. data/lib/action_view/testing/resolvers.rb +2 -2
  50. data/lib/action_view/view_paths.rb +26 -15
  51. metadata +52 -18
  52. data/lib/action_view/vendor/html-scanner.rb +0 -20
  53. data/lib/action_view/vendor/html-scanner/html/document.rb +0 -68
  54. data/lib/action_view/vendor/html-scanner/html/node.rb +0 -532
  55. data/lib/action_view/vendor/html-scanner/html/sanitizer.rb +0 -188
  56. data/lib/action_view/vendor/html-scanner/html/selector.rb +0 -830
  57. data/lib/action_view/vendor/html-scanner/html/tokenizer.rb +0 -107
  58. data/lib/action_view/vendor/html-scanner/html/version.rb +0 -11
@@ -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/4-1-stable/actionview
16
+ * https://github.com/rails/rails/tree/master/actionview
17
17
 
18
18
 
19
19
  == License
@@ -29,6 +29,11 @@ API documentation is at
29
29
 
30
30
  * http://api.rubyonrails.org
31
31
 
32
- Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:
32
+ Bug reports can be filed for the Ruby on Rails project here:
33
33
 
34
34
  * https://github.com/rails/rails/issues
35
+
36
+ Feature requests should be discussed on the rails-core mailing list here:
37
+
38
+ * https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-core
39
+
@@ -86,7 +86,6 @@ module ActionView
86
86
  super
87
87
  ActionView::Helpers.eager_load!
88
88
  ActionView::Template.eager_load!
89
- HTML.eager_load!
90
89
  end
91
90
  end
92
91
 
@@ -66,15 +66,6 @@ module ActionView #:nodoc:
66
66
  # Headline: <%= headline %>
67
67
  # First name: <%= person.first_name %>
68
68
  #
69
- # If you need to find out whether a certain local variable has been assigned a value in a particular render call,
70
- # you need to use the following pattern:
71
- #
72
- # <% if local_assigns.has_key? :headline %>
73
- # Headline: <%= headline %>
74
- # <% end %>
75
- #
76
- # Testing using <tt>defined? headline</tt> will not work. This is an implementation restriction.
77
- #
78
69
  # === Template caching
79
70
  #
80
71
  # By default, Rails will compile each template to a method in order to render it. When you alter a template,
@@ -131,7 +122,8 @@ module ActionView #:nodoc:
131
122
  # end
132
123
  # end
133
124
  #
134
- # More builder documentation can be found at http://builder.rubyforge.org.
125
+ # For more information on Builder please consult the [source
126
+ # code](https://github.com/jimweirich/builder).
135
127
  class Base
136
128
  include Helpers, ::ERB::Util, Context
137
129
 
@@ -60,7 +60,7 @@ module ActionView
60
60
 
61
61
  def digest
62
62
  Digest::MD5.hexdigest("#{source}-#{dependency_digest}").tap do |digest|
63
- logger.try :info, " Cache digest for #{template.inspect}: #{digest}"
63
+ logger.try :debug, " Cache digest for #{template.inspect}: #{digest}"
64
64
  end
65
65
  rescue ActionView::MissingTemplate
66
66
  logger.try :error, " Couldn't find template for digesting: #{name}"
@@ -6,9 +6,9 @@ module ActionView
6
6
 
7
7
  module VERSION
8
8
  MAJOR = 4
9
- MINOR = 1
10
- TINY = 16
11
- PRE = nil
9
+ MINOR = 2
10
+ TINY = 0
11
+ PRE = "beta1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -7,7 +7,7 @@ module ActionView
7
7
  # = Action View Asset Tag Helpers
8
8
  module Helpers #:nodoc:
9
9
  # This module provides methods for generating HTML that links views to assets such
10
- # as images, javascripts, stylesheets, and feeds. These methods do not verify
10
+ # as images, JavaScripts, stylesheets, and feeds. These methods do not verify
11
11
  # the assets exist before linking to them:
12
12
  #
13
13
  # image_tag("rails.png")
@@ -142,22 +142,29 @@ module ActionView
142
142
  )
143
143
  end
144
144
 
145
- # Returns a link loading a favicon file. You may specify a different file
146
- # in the first argument. The helper accepts an additional options hash where
147
- # you can override "rel" and "type".
145
+ # Returns a link tag for a favicon managed by the asset pipeline.
148
146
  #
149
- # ==== Options
147
+ # If a page has no link like the one generated by this helper, browsers
148
+ # ask for <tt>/favicon.ico</tt> automatically, and cache the file if the
149
+ # request succeeds. If the favicon changes it is hard to get it updated.
150
150
  #
151
- # * <tt>:rel</tt> - Specify the relation of this link, defaults to 'shortcut icon'
152
- # * <tt>:type</tt> - Override the auto-generated mime type, defaults to 'image/vnd.microsoft.icon'
151
+ # To have better control applications may let the asset pipeline manage
152
+ # their favicon storing the file under <tt>app/assets/images</tt>, and
153
+ # using this helper to generate its corresponding link tag.
153
154
  #
154
- # ==== Examples
155
+ # The helper gets the name of the favicon file as first argument, which
156
+ # defaults to "favicon.ico", and also supports +:rel+ and +:type+ options
157
+ # to override their defaults, "shortcut icon" and "image/x-icon"
158
+ # respectively:
159
+ #
160
+ # favicon_link_tag
161
+ # # => <link href="/assets/favicon.ico" rel="shortcut icon" type="image/x-icon" />
155
162
  #
156
163
  # favicon_link_tag 'myicon.ico'
157
- # # => <link href="/assets/myicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
164
+ # # => <link href="/assets/myicon.ico" rel="shortcut icon" type="image/x-icon" />
158
165
  #
159
- # Mobile Safari looks for a different <link> tag, pointing to an image that
160
- # will be used if you add the page to the home screen of an iPod Touch, iPhone, or iPad.
166
+ # Mobile Safari looks for a different link tag, pointing to an image that
167
+ # will be used if you add the page to the home screen of an iOS device.
161
168
  # The following call would generate such a tag:
162
169
  #
163
170
  # favicon_link_tag 'mb-icon.png', rel: 'apple-touch-icon', type: 'image/png'
@@ -165,7 +172,7 @@ module ActionView
165
172
  def favicon_link_tag(source='favicon.ico', options={})
166
173
  tag('link', {
167
174
  :rel => 'shortcut icon',
168
- :type => 'image/vnd.microsoft.icon',
175
+ :type => 'image/x-icon',
169
176
  :href => path_to_image(source)
170
177
  }.merge!(options.symbolize_keys))
171
178
  end
@@ -211,7 +218,7 @@ module ActionView
211
218
  tag("img", options)
212
219
  end
213
220
 
214
- # Returns a string suitable for an html image tag alt attribute.
221
+ # Returns a string suitable for an HTML image tag alt attribute.
215
222
  # The +src+ argument is meant to be an image file path.
216
223
  # The method removes the basename of the file path and the digest,
217
224
  # if any. It also removes hyphens and underscores from file names and
@@ -229,10 +236,10 @@ module ActionView
229
236
  # image_alt('underscored_file_name.png')
230
237
  # # => Underscored file name
231
238
  def image_alt(src)
232
- File.basename(src, '.*').sub(/-[[:xdigit:]]{32,64}\z/, '').tr('-_', ' ').capitalize
239
+ File.basename(src, '.*').sub(/-[[:xdigit:]]{32}\z/, '').tr('-_', ' ').capitalize
233
240
  end
234
241
 
235
- # Returns an html video tag for the +sources+. If +sources+ is a string,
242
+ # Returns an HTML video tag for the +sources+. If +sources+ is a string,
236
243
  # a single video tag will be returned. If +sources+ is an array, a video
237
244
  # tag with nested source tags for each source will be returned. The
238
245
  # +sources+ can be full paths or files that exists in your public videos
@@ -251,19 +258,19 @@ module ActionView
251
258
  # ==== Examples
252
259
  #
253
260
  # video_tag("trailer")
254
- # # => <video src="/videos/trailer" />
261
+ # # => <video src="/videos/trailer"></video>
255
262
  # video_tag("trailer.ogg")
256
- # # => <video src="/videos/trailer.ogg" />
263
+ # # => <video src="/videos/trailer.ogg"></video>
257
264
  # video_tag("trailer.ogg", controls: true, autobuffer: true)
258
- # # => <video autobuffer="autobuffer" controls="controls" src="/videos/trailer.ogg" />
265
+ # # => <video autobuffer="autobuffer" controls="controls" src="/videos/trailer.ogg" ></video>
259
266
  # video_tag("trailer.m4v", size: "16x10", poster: "screenshot.png")
260
- # # => <video src="/videos/trailer.m4v" width="16" height="10" poster="/assets/screenshot.png" />
267
+ # # => <video src="/videos/trailer.m4v" width="16" height="10" poster="/assets/screenshot.png"></video>
261
268
  # video_tag("/trailers/hd.avi", size: "16x16")
262
- # # => <video src="/trailers/hd.avi" width="16" height="16" />
269
+ # # => <video src="/trailers/hd.avi" width="16" height="16"></video>
263
270
  # video_tag("/trailers/hd.avi", size: "16")
264
- # # => <video height="16" src="/trailers/hd.avi" width="16" />
271
+ # # => <video height="16" src="/trailers/hd.avi" width="16"></video>
265
272
  # video_tag("/trailers/hd.avi", height: '32', width: '32')
266
- # # => <video height="32" src="/trailers/hd.avi" width="32" />
273
+ # # => <video height="32" src="/trailers/hd.avi" width="32"></video>
267
274
  # video_tag("trailer.ogg", "trailer.flv")
268
275
  # # => <video><source src="/videos/trailer.ogg" /><source src="/videos/trailer.flv" /></video>
269
276
  # video_tag(["trailer.ogg", "trailer.flv"])
@@ -282,11 +289,11 @@ module ActionView
282
289
  # your public audios directory.
283
290
  #
284
291
  # audio_tag("sound")
285
- # # => <audio src="/audios/sound" />
292
+ # # => <audio src="/audios/sound"></audio>
286
293
  # audio_tag("sound.wav")
287
- # # => <audio src="/audios/sound.wav" />
294
+ # # => <audio src="/audios/sound.wav"></audio>
288
295
  # audio_tag("sound.wav", autoplay: true, controls: true)
289
- # # => <audio autoplay="autoplay" controls="controls" src="/audios/sound.wav" />
296
+ # # => <audio autoplay="autoplay" controls="controls" src="/audios/sound.wav"></audio>
290
297
  # audio_tag("sound.wav", "sound.mid")
291
298
  # # => <audio><source src="/audios/sound.wav" /><source src="/audios/sound.mid" /></audio>
292
299
  def audio_tag(*sources)
@@ -88,9 +88,12 @@ module ActionView
88
88
  # still sending assets for plain HTTP requests from asset hosts. If you don't
89
89
  # have SSL certificates for each of the asset hosts this technique allows you
90
90
  # to avoid warnings in the client about mixed media.
91
+ # Note that the request parameter might not be supplied, e.g. when the assets
92
+ # are precompiled via a Rake task. Make sure to use a Proc instead of a lambda,
93
+ # since a Proc allows missing parameters and sets them to nil.
91
94
  #
92
95
  # config.action_controller.asset_host = Proc.new { |source, request|
93
- # if request.ssl?
96
+ # if request && request.ssl?
94
97
  # "#{request.protocol}#{request.host_with_port}"
95
98
  # else
96
99
  # "#{request.protocol}assets.example.com"
@@ -113,13 +116,13 @@ module ActionView
113
116
  #
114
117
  # All other asset *_path helpers delegate through this method.
115
118
  #
116
- # asset_path "application.js" # => /application.js
117
- # asset_path "application", type: :javascript # => /javascripts/application.js
118
- # asset_path "application", type: :stylesheet # => /stylesheets/application.css
119
+ # asset_path "application.js" # => /assets/application.js
120
+ # asset_path "application", type: :javascript # => /assets/application.js
121
+ # asset_path "application", type: :stylesheet # => /assets/application.css
119
122
  # asset_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js
120
123
  def asset_path(source, options = {})
121
- source = source.to_s
122
124
  return "" unless source.present?
125
+ source = source.to_s
123
126
  return source if source =~ URI_REGEXP
124
127
 
125
128
  tail, source = source[/([\?#].+)$/], source.sub(/([\?#].+)$/, '')
@@ -147,7 +150,14 @@ module ActionView
147
150
 
148
151
  # Computes the full URL to an asset in the public directory. This
149
152
  # will use +asset_path+ internally, so most of their behaviors
150
- # will be the same.
153
+ # will be the same. If :host options is set, it overwrites global
154
+ # +config.action_controller.asset_host+ setting.
155
+ #
156
+ # All other options provided are forwarded to +asset_path+ call.
157
+ #
158
+ # asset_url "application.js" # => http://example.com/assets/application.js
159
+ # asset_url "application.js", host: "http://cdn.example.com" # => http://cdn.example.com/assets/application.js
160
+ #
151
161
  def asset_url(source, options = {})
152
162
  path_to_asset(source, options.merge(:protocol => :request))
153
163
  end
@@ -191,7 +201,8 @@ module ActionView
191
201
  # (proc or otherwise).
192
202
  def compute_asset_host(source = "", options = {})
193
203
  request = self.request if respond_to?(:request)
194
- host = config.asset_host if defined? config.asset_host
204
+ host = options[:host]
205
+ host ||= config.asset_host if defined? config.asset_host
195
206
 
196
207
  if host.respond_to?(:call)
197
208
  arity = host.respond_to?(:arity) ? host.arity : host.method(:call).arity
@@ -220,13 +231,13 @@ module ActionView
220
231
  end
221
232
  end
222
233
 
223
- # Computes the path to a javascript asset in the public javascripts directory.
234
+ # Computes the path to a JavaScript asset in the public javascripts directory.
224
235
  # If the +source+ filename has no extension, .js will be appended (except for explicit URIs)
225
236
  # Full paths from the document root will be passed through.
226
- # Used internally by javascript_include_tag to build the script path.
237
+ # Used internally by +javascript_include_tag+ to build the script path.
227
238
  #
228
- # javascript_path "xmlhr" # => /javascripts/xmlhr.js
229
- # javascript_path "dir/xmlhr.js" # => /javascripts/dir/xmlhr.js
239
+ # javascript_path "xmlhr" # => /assets/xmlhr.js
240
+ # javascript_path "dir/xmlhr.js" # => /assets/dir/xmlhr.js
230
241
  # javascript_path "/dir/xmlhr" # => /dir/xmlhr.js
231
242
  # javascript_path "http://www.example.com/js/xmlhr" # => http://www.example.com/js/xmlhr
232
243
  # javascript_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js
@@ -235,7 +246,7 @@ module ActionView
235
246
  end
236
247
  alias_method :path_to_javascript, :javascript_path # aliased to avoid conflicts with a javascript_path named route
237
248
 
238
- # Computes the full URL to a javascript asset in the public javascripts directory.
249
+ # Computes the full URL to a JavaScript asset in the public javascripts directory.
239
250
  # This will use +javascript_path+ internally, so most of their behaviors will be the same.
240
251
  def javascript_url(source, options = {})
241
252
  url_to_asset(source, {type: :javascript}.merge!(options))
@@ -243,12 +254,12 @@ module ActionView
243
254
  alias_method :url_to_javascript, :javascript_url # aliased to avoid conflicts with a javascript_url named route
244
255
 
245
256
  # Computes the path to a stylesheet asset in the public stylesheets directory.
246
- # If the +source+ filename has no extension, <tt>.css</tt> will be appended (except for explicit URIs).
257
+ # If the +source+ filename has no extension, .css will be appended (except for explicit URIs).
247
258
  # Full paths from the document root will be passed through.
248
259
  # Used internally by +stylesheet_link_tag+ to build the stylesheet path.
249
260
  #
250
- # stylesheet_path "style" # => /stylesheets/style.css
251
- # stylesheet_path "dir/style.css" # => /stylesheets/dir/style.css
261
+ # stylesheet_path "style" # => /assets/style.css
262
+ # stylesheet_path "dir/style.css" # => /assets/dir/style.css
252
263
  # stylesheet_path "/dir/style.css" # => /dir/style.css
253
264
  # stylesheet_path "http://www.example.com/css/style" # => http://www.example.com/css/style
254
265
  # stylesheet_path "http://www.example.com/css/style.css" # => http://www.example.com/css/style.css
@@ -334,9 +345,9 @@ module ActionView
334
345
  # Computes the path to a font asset.
335
346
  # Full paths from the document root will be passed through.
336
347
  #
337
- # font_path("font") # => /assets/font
338
- # font_path("font.ttf") # => /assets/font.ttf
339
- # font_path("dir/font.ttf") # => /assets/dir/font.ttf
348
+ # font_path("font") # => /fonts/font
349
+ # font_path("font.ttf") # => /fonts/font.ttf
350
+ # font_path("dir/font.ttf") # => /fonts/dir/font.ttf
340
351
  # font_path("/dir/font.ttf") # => /dir/font.ttf
341
352
  # font_path("http://www.example.com/dir/font.ttf") # => http://www.example.com/dir/font.ttf
342
353
  def font_path(source, options = {})
@@ -11,7 +11,7 @@ module ActionView
11
11
  # The best way to use this is by doing key-based cache expiration
12
12
  # on top of a cache store like Memcached that'll automatically
13
13
  # kick out old entries. For more on key-based expiration, see:
14
- # http://37signals.com/svn/posts/3113-how-key-based-cache-expiration-works
14
+ # http://signalvnoise.com/posts/3113-how-key-based-cache-expiration-works
15
15
  #
16
16
  # When using this method, you list the cache dependency as the name of the cache, like so:
17
17
  #
@@ -111,7 +111,7 @@ module ActionView
111
111
  #
112
112
  # Now all you'll have to do is change that timestamp when the helper method changes.
113
113
  def cache(name = {}, options = nil, &block)
114
- if controller.respond_to?(:perform_caching) && controller.perform_caching
114
+ if controller.perform_caching
115
115
  safe_concat(fragment_for(cache_fragment_name(name, options), options, &block))
116
116
  else
117
117
  yield
@@ -194,9 +194,7 @@ module ActionView
194
194
  def with_output_buffer(buf = nil) #:nodoc:
195
195
  unless buf
196
196
  buf = ActionView::OutputBuffer.new
197
- if output_buffer && output_buffer.respond_to?(:encoding)
198
- buf.force_encoding(output_buffer.encoding)
199
- end
197
+ buf.force_encoding(output_buffer.encoding) if output_buffer
200
198
  end
201
199
  self.output_buffer, old_buffer = buf, output_buffer
202
200
  yield
@@ -204,15 +202,6 @@ module ActionView
204
202
  ensure
205
203
  self.output_buffer = old_buffer
206
204
  end
207
-
208
- # Add the output buffer to the response body and start a new one.
209
- def flush_output_buffer #:nodoc:
210
- if output_buffer && !output_buffer.empty?
211
- response.stream.write output_buffer
212
- self.output_buffer = output_buffer.respond_to?(:clone_empty) ? output_buffer.clone_empty : output_buffer[0, 0]
213
- nil
214
- end
215
- end
216
205
  end
217
206
  end
218
207
  end
@@ -19,6 +19,10 @@ module ActionView
19
19
  # the <tt>select_month</tt> method would use simply "date" (which can be overwritten using <tt>:prefix</tt>) instead
20
20
  # of \date[month].
21
21
  module DateHelper
22
+ MINUTES_IN_YEAR = 525600
23
+ MINUTES_IN_QUARTER_YEAR = 131400
24
+ MINUTES_IN_THREE_QUARTERS_YEAR = 394200
25
+
22
26
  # Reports the approximate distance in time between two Time, Date or DateTime objects or integers as seconds.
23
27
  # Pass <tt>include_seconds: true</tt> if you want more detailed approximations when distance < 1 min, 29 secs.
24
28
  # Distances are reported based on the following table:
@@ -120,11 +124,11 @@ module ActionView
120
124
  else
121
125
  minutes_with_offset = distance_in_minutes
122
126
  end
123
- remainder = (minutes_with_offset % 525600)
124
- distance_in_years = (minutes_with_offset.div 525600)
125
- if remainder < 131400
127
+ remainder = (minutes_with_offset % MINUTES_IN_YEAR)
128
+ distance_in_years = (minutes_with_offset.div MINUTES_IN_YEAR)
129
+ if remainder < MINUTES_IN_QUARTER_YEAR
126
130
  locale.t(:about_x_years, :count => distance_in_years)
127
- elsif remainder < 394200
131
+ elsif remainder < MINUTES_IN_THREE_QUARTERS_YEAR
128
132
  locale.t(:over_x_years, :count => distance_in_years)
129
133
  else
130
134
  locale.t(:almost_x_years, :count => distance_in_years + 1)
@@ -149,8 +153,8 @@ module ActionView
149
153
  #
150
154
  # Note that you cannot pass a <tt>Numeric</tt> value to <tt>time_ago_in_words</tt>.
151
155
  #
152
- def time_ago_in_words(from_time, include_seconds_or_options = {})
153
- distance_of_time_in_words(from_time, Time.now, include_seconds_or_options)
156
+ def time_ago_in_words(from_time, options = {})
157
+ distance_of_time_in_words(from_time, Time.now, options)
154
158
  end
155
159
 
156
160
  alias_method :distance_of_time_in_words_to_now, :time_ago_in_words
@@ -326,7 +330,7 @@ module ActionView
326
330
  Tags::DatetimeSelect.new(object_name, method, self, options, html_options).render
327
331
  end
328
332
 
329
- # Returns a set of html select-tags (one for year, month, day, hour, minute, and second) pre-selected with the
333
+ # Returns a set of HTML select-tags (one for year, month, day, hour, minute, and second) pre-selected with the
330
334
  # +datetime+. It's also possible to explicitly set the order of the tags using the <tt>:order</tt> option with
331
335
  # an array of symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order. If you do not
332
336
  # supply a Symbol, it will be appended onto the <tt>:order</tt> passed in. You can also add
@@ -375,7 +379,7 @@ module ActionView
375
379
  DateTimeSelector.new(datetime, options, html_options).select_datetime
376
380
  end
377
381
 
378
- # Returns a set of html select-tags (one for year, month, and day) pre-selected with the +date+.
382
+ # Returns a set of HTML select-tags (one for year, month, and day) pre-selected with the +date+.
379
383
  # It's possible to explicitly set the order of the tags using the <tt>:order</tt> option with an array of
380
384
  # symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order.
381
385
  # If the array passed to the <tt>:order</tt> option does not contain all the three symbols, all tags will be hidden.
@@ -414,7 +418,7 @@ module ActionView
414
418
  DateTimeSelector.new(date, options, html_options).select_date
415
419
  end
416
420
 
417
- # Returns a set of html select-tags (one for hour and minute).
421
+ # Returns a set of HTML select-tags (one for hour and minute).
418
422
  # You can set <tt>:time_separator</tt> key to format the output, and
419
423
  # the <tt>:include_seconds</tt> option to include an input for seconds.
420
424
  #
@@ -631,7 +635,7 @@ module ActionView
631
635
  DateTimeSelector.new(date, options, html_options).select_year
632
636
  end
633
637
 
634
- # Returns an html time tag for the given date or time.
638
+ # Returns an HTML time tag for the given date or time.
635
639
  #
636
640
  # time_tag Date.today # =>
637
641
  # <time datetime="2010-11-04">November 04, 2010</time>
@@ -910,7 +914,7 @@ module ActionView
910
914
  build_select(type, build_options(selected, options))
911
915
  end
912
916
 
913
- # Build select option html from date value and options.
917
+ # Build select option HTML from date value and options.
914
918
  # build_options(15, start: 1, end: 31)
915
919
  # => "<option value="1">1</option>
916
920
  # <option value="2">2</option>
@@ -950,7 +954,7 @@ module ActionView
950
954
  (select_options.join("\n") + "\n").html_safe
951
955
  end
952
956
 
953
- # Builds select tag from date type and html select options.
957
+ # Builds select tag from date type and HTML select options.
954
958
  # build_select(:month, "<option value="1">January</option>...")
955
959
  # => "<select id="post_written_on_2i" name="post[written_on(2i)]">
956
960
  # <option value="1">January</option>...
@@ -11,24 +11,20 @@ module ActionView
11
11
  # If the object cannot be converted to YAML using +to_yaml+, +inspect+ will be called instead.
12
12
  # Useful for inspecting an object at the time of rendering.
13
13
  #
14
- # @user = User.new({ username: 'testing', password: 'xyz', age: 42}) %>
14
+ # @user = User.new({ username: 'testing', password: 'xyz', age: 42})
15
15
  # debug(@user)
16
16
  # # =>
17
17
  # <pre class='debug_dump'>--- !ruby/object:User
18
18
  # attributes:
19
- # &nbsp; updated_at:
20
- # &nbsp; username: testing
21
- #
22
- # &nbsp; age: 42
23
- # &nbsp; password: xyz
24
- # &nbsp; created_at:
25
- # attributes_cache: {}
26
- #
27
- # new_record: true
19
+ # updated_at:
20
+ # username: testing
21
+ # age: 42
22
+ # password: xyz
23
+ # created_at:
28
24
  # </pre>
29
25
  def debug(object)
30
26
  Marshal::dump(object)
31
- object = ERB::Util.html_escape(object.to_yaml).gsub(" ", "&nbsp; ").html_safe
27
+ object = ERB::Util.html_escape(object.to_yaml)
32
28
  content_tag(:pre, object, :class => "debug_dump")
33
29
  rescue Exception # errors from Marshal or YAML
34
30
  # Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback