actionpack 3.1.0.rc4 → 3.1.0.rc5

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.

Files changed (40) hide show
  1. data/CHANGELOG +6 -0
  2. data/lib/abstract_controller/asset_paths.rb +1 -1
  3. data/lib/abstract_controller/layouts.rb +10 -8
  4. data/lib/action_controller/base.rb +13 -11
  5. data/lib/action_controller/caching/sweeping.rb +1 -0
  6. data/lib/action_controller/metal/redirecting.rb +1 -0
  7. data/lib/action_controller/metal/request_forgery_protection.rb +10 -9
  8. data/lib/action_controller/metal/responder.rb +5 -0
  9. data/lib/action_controller/metal/streaming.rb +6 -14
  10. data/lib/action_controller/railtie.rb +0 -1
  11. data/lib/action_controller/test_case.rb +19 -0
  12. data/lib/action_dispatch/http/upload.rb +11 -1
  13. data/lib/action_dispatch/middleware/cookies.rb +5 -0
  14. data/lib/action_dispatch/routing/mapper.rb +10 -9
  15. data/lib/action_dispatch/routing/polymorphic_routes.rb +4 -9
  16. data/lib/action_dispatch/testing/test_request.rb +1 -1
  17. data/lib/action_pack/version.rb +1 -1
  18. data/lib/action_view.rb +1 -0
  19. data/lib/action_view/asset_paths.rb +148 -0
  20. data/lib/action_view/base.rb +1 -1
  21. data/lib/action_view/helpers/asset_paths.rb +2 -78
  22. data/lib/action_view/helpers/asset_tag_helper.rb +8 -2
  23. data/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb +11 -12
  24. data/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb +2 -2
  25. data/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb +4 -3
  26. data/lib/action_view/helpers/cache_helper.rb +4 -6
  27. data/lib/action_view/helpers/controller_helper.rb +2 -0
  28. data/lib/action_view/helpers/date_helper.rb +47 -47
  29. data/lib/action_view/helpers/form_helper.rb +45 -11
  30. data/lib/action_view/helpers/form_tag_helper.rb +1 -1
  31. data/lib/action_view/helpers/number_helper.rb +3 -1
  32. data/lib/action_view/helpers/text_helper.rb +5 -6
  33. data/lib/action_view/helpers/translation_helper.rb +2 -2
  34. data/lib/action_view/helpers/url_helper.rb +11 -11
  35. data/lib/action_view/renderer/partial_renderer.rb +27 -22
  36. data/lib/sprockets/assets.rake +23 -0
  37. data/lib/sprockets/compressors.rb +21 -0
  38. data/lib/sprockets/helpers/rails_helper.rb +44 -19
  39. data/lib/sprockets/railtie.rb +29 -18
  40. metadata +29 -54
@@ -194,7 +194,7 @@ module ActionView #:nodoc:
194
194
  end
195
195
 
196
196
  def initialize(context = nil, assigns = {}, controller = nil, formats = nil) #:nodoc:
197
- @_config = {}
197
+ @_config = ActiveSupport::InheritableOptions.new
198
198
 
199
199
  # Handle all these for backwards compatibility.
200
200
  # TODO Provide a new API for AV::Base and deprecate this one.
@@ -1,83 +1,7 @@
1
- require 'active_support/core_ext/file'
1
+ ActiveSupport::Deprecation.warn "ActionView::Helpers::AssetPaths is deprecated. Please use ActionView::AssetPaths instead."
2
2
 
3
3
  module ActionView
4
4
  module Helpers
5
-
6
- class AssetPaths #:nodoc:
7
- attr_reader :config, :controller
8
-
9
- def initialize(config, controller)
10
- @config = config
11
- @controller = controller
12
- end
13
-
14
- # Add the extension +ext+ if not present. Return full or scheme-relative URLs otherwise untouched.
15
- # Prefix with <tt>/dir/</tt> if lacking a leading +/+. Account for relative URL
16
- # roots. Rewrite the asset path for cache-busting asset ids. Include
17
- # asset host, if configured, with the correct request protocol.
18
- def compute_public_path(source, dir, ext = nil, include_host = true)
19
- source = source.to_s
20
- return source if is_uri?(source)
21
-
22
- source = rewrite_extension(source, dir, ext) if ext
23
- source = rewrite_asset_path(source, dir)
24
-
25
- if controller && include_host
26
- has_request = controller.respond_to?(:request)
27
- source = rewrite_host_and_protocol(source, has_request)
28
- end
29
-
30
- source
31
- end
32
-
33
- def is_uri?(path)
34
- path =~ %r{^[-a-z]+://|^cid:|^//}
35
- end
36
-
37
- private
38
-
39
- def rewrite_extension(source, dir, ext)
40
- raise NotImplementedError
41
- end
42
-
43
- def rewrite_asset_path(source, path = nil)
44
- raise NotImplementedError
45
- end
46
-
47
- def rewrite_relative_url_root(source, relative_url_root)
48
- relative_url_root && !source.starts_with?("#{relative_url_root}/") ? "#{relative_url_root}#{source}" : source
49
- end
50
-
51
- def rewrite_host_and_protocol(source, has_request)
52
- source = rewrite_relative_url_root(source, controller.config.relative_url_root) if has_request
53
- host = compute_asset_host(source)
54
- if has_request && host && !is_uri?(host)
55
- host = "#{controller.request.protocol}#{host}"
56
- end
57
- "#{host}#{source}"
58
- end
59
-
60
- # Pick an asset host for this source. Returns +nil+ if no host is set,
61
- # the host if no wildcard is set, the host interpolated with the
62
- # numbers 0-3 if it contains <tt>%d</tt> (the number is the source hash mod 4),
63
- # or the value returned from invoking the proc if it's a proc or the value from
64
- # invoking call if it's an object responding to call.
65
- def compute_asset_host(source)
66
- if host = config.asset_host
67
- if host.is_a?(Proc) || host.respond_to?(:call)
68
- case host.is_a?(Proc) ? host.arity : host.method(:call).arity
69
- when 2
70
- request = controller.respond_to?(:request) && controller.request
71
- host.call(source, request)
72
- else
73
- host.call(source)
74
- end
75
- else
76
- (host =~ /%d/) ? host % (source.hash % 4) : host
77
- end
78
- end
79
- end
80
- end
81
-
5
+ AssetPaths = ::ActionView::AssetPaths
82
6
  end
83
7
  end
@@ -1,6 +1,7 @@
1
1
  require 'action_view/helpers/asset_tag_helpers/javascript_tag_helpers'
2
2
  require 'action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers'
3
3
  require 'action_view/helpers/asset_tag_helpers/asset_paths'
4
+ require 'action_view/helpers/tag_helper'
4
5
 
5
6
  module ActionView
6
7
  # = Action View Asset Tag Helpers
@@ -153,7 +154,7 @@ module ActionView
153
154
  # "/release-#{RELEASE_NUMBER}#{asset_path}"
154
155
  # }
155
156
  #
156
- # This example would cause the following behaviour on all servers no
157
+ # This example would cause the following behavior on all servers no
157
158
  # matter when they were deployed:
158
159
  #
159
160
  # image_tag("rails.png")
@@ -191,6 +192,7 @@ module ActionView
191
192
  # RewriteEngine On
192
193
  # RewriteRule ^/release-\d+/(images|javascripts|stylesheets)/(.*)$ /$1/$2 [L]
193
194
  module AssetTagHelper
195
+ include TagHelper
194
196
  include JavascriptTagHelpers
195
197
  include StylesheetTagHelpers
196
198
  # Returns a link tag that browsers and news readers can use to auto-detect
@@ -347,7 +349,7 @@ module ActionView
347
349
  src = options[:src] = path_to_image(source)
348
350
 
349
351
  unless src =~ /^cid:/
350
- options[:alt] = options.fetch(:alt){ File.basename(src, '.*').capitalize }
352
+ options[:alt] = options.fetch(:alt){ image_alt(src) }
351
353
  end
352
354
 
353
355
  if size = options.delete(:size)
@@ -362,6 +364,10 @@ module ActionView
362
364
  tag("img", options)
363
365
  end
364
366
 
367
+ def image_alt(src)
368
+ File.basename(src, '.*').sub(/-[[:xdigit:]]{32}\z/, '').capitalize
369
+ end
370
+
365
371
  # Returns an html video tag for the +sources+. If +sources+ is a string,
366
372
  # a single video tag will be returned. If +sources+ is an array, a video
367
373
  # tag with nested source tags for each source will be returned. The
@@ -60,12 +60,16 @@ module ActionView
60
60
 
61
61
  private
62
62
 
63
- def path_to_asset(source, include_host = true)
64
- asset_paths.compute_public_path(source, asset_name.to_s.pluralize, extension, include_host)
63
+ def path_to_asset(source, include_host = true, protocol = nil)
64
+ asset_paths.compute_public_path(source, asset_name.to_s.pluralize, extension, include_host, protocol)
65
+ end
66
+
67
+ def path_to_asset_source(source)
68
+ asset_paths.compute_source_path(source, asset_name.to_s.pluralize, extension)
65
69
  end
66
70
 
67
71
  def compute_paths(*args)
68
- expand_sources(*args).collect { |source| asset_paths.compute_public_path(source, asset_name.pluralize, extension, false) }
72
+ expand_sources(*args).collect { |source| path_to_asset_source(source) }
69
73
  end
70
74
 
71
75
  def expand_sources(sources, recursive)
@@ -92,7 +96,7 @@ module ActionView
92
96
 
93
97
  def ensure_sources!(sources)
94
98
  sources.each do |source|
95
- asset_file_path!(path_to_asset(source, false))
99
+ asset_file_path!(path_to_asset_source(source))
96
100
  end
97
101
  end
98
102
 
@@ -123,19 +127,14 @@ module ActionView
123
127
 
124
128
  # Set mtime to the latest of the combined files to allow for
125
129
  # consistent ETag without a shared filesystem.
126
- mt = asset_paths.map { |p| File.mtime(asset_file_path(p)) }.max
130
+ mt = asset_paths.map { |p| File.mtime(asset_file_path!(p)) }.max
127
131
  File.utime(mt, mt, joined_asset_path)
128
132
  end
129
133
 
130
- def asset_file_path(path)
131
- File.join(config.assets_dir, path.split('?').first)
132
- end
133
-
134
- def asset_file_path!(path, error_if_file_is_uri = false)
135
- if asset_paths.is_uri?(path)
134
+ def asset_file_path!(absolute_path, error_if_file_is_uri = false)
135
+ if asset_paths.is_uri?(absolute_path)
136
136
  raise(Errno::ENOENT, "Asset file #{path} is uri and cannot be merged into single file") if error_if_file_is_uri
137
137
  else
138
- absolute_path = asset_file_path(path)
139
138
  raise(Errno::ENOENT, "Asset file not found at '#{absolute_path}'" ) unless File.exist?(absolute_path)
140
139
  return absolute_path
141
140
  end
@@ -1,11 +1,11 @@
1
+ require 'thread'
1
2
  require 'active_support/core_ext/file'
2
- require 'action_view/helpers/asset_paths'
3
3
 
4
4
  module ActionView
5
5
  module Helpers
6
6
  module AssetTagHelper
7
7
 
8
- class AssetPaths < ActionView::Helpers::AssetPaths #:nodoc:
8
+ class AssetPaths < ::ActionView::AssetPaths #:nodoc:
9
9
  # You can enable or disable the asset tag ids cache.
10
10
  # With the cache enabled, the asset tag helper methods will make fewer
11
11
  # expensive file system calls (the default implementation checks the file
@@ -16,7 +16,8 @@ module ActionView
16
16
  end
17
17
 
18
18
  def asset_tag(source, options)
19
- tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => ERB::Util.html_escape(path_to_asset(source)) }.merge(options), false, false)
19
+ # We force the :request protocol here to avoid a double-download bug in IE7 and IE8
20
+ tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => ERB::Util.html_escape(path_to_asset(source, true, :request)) }.merge(options), false, false)
20
21
  end
21
22
 
22
23
  def custom_dir
@@ -52,7 +53,7 @@ module ActionView
52
53
  # If the +source+ filename has no extension, <tt>.css</tt> will be appended (except for explicit URIs).
53
54
  # Full paths from the document root will be passed through.
54
55
  # Used internally by +stylesheet_link_tag+ to build the stylesheet path.
55
- #
56
+ #
56
57
  # ==== Examples
57
58
  # stylesheet_path "style" # => /stylesheets/style.css
58
59
  # stylesheet_path "dir/style.css" # => /stylesheets/dir/style.css
@@ -60,7 +61,7 @@ module ActionView
60
61
  # stylesheet_path "http://www.example.com/css/style" # => http://www.example.com/css/style
61
62
  # stylesheet_path "http://www.example.com/css/style.css" # => http://www.example.com/css/style.css
62
63
  def stylesheet_path(source)
63
- asset_paths.compute_public_path(source, 'stylesheets', 'css')
64
+ asset_paths.compute_public_path(source, 'stylesheets', 'css', true, :request)
64
65
  end
65
66
  alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with a stylesheet_path named route
66
67
 
@@ -51,12 +51,10 @@ module ActionView
51
51
  # This dance is needed because Builder can't use capture
52
52
  pos = output_buffer.length
53
53
  yield
54
- if output_buffer.is_a?(ActionView::OutputBuffer)
55
- safe_output_buffer = output_buffer.to_str
56
- fragment = safe_output_buffer.slice!(pos..-1)
57
- self.output_buffer = ActionView::OutputBuffer.new(safe_output_buffer)
58
- else
59
- fragment = output_buffer.slice!(pos..-1)
54
+ output_safe = output_buffer.html_safe?
55
+ fragment = output_buffer.slice!(pos..-1)
56
+ if output_safe
57
+ self.output_buffer = output_buffer.class.new(output_buffer)
60
58
  end
61
59
  controller.write_fragment(name, fragment, options)
62
60
  end
@@ -1,3 +1,5 @@
1
+ require 'active_support/core_ext/module/attr_internal'
2
+
1
3
  module ActionView
2
4
  module Helpers
3
5
  # This module keeps all methods and behavior in ActionView
@@ -8,8 +8,8 @@ module ActionView
8
8
  module Helpers
9
9
  # = Action View Date Helpers
10
10
  #
11
- # The Date Helper primarily creates select/option tags for different kinds of dates and date elements. All of the
12
- # select-type methods share a number of common options that are as follows:
11
+ # The Date Helper primarily creates select/option tags for different kinds of dates and times or date and time
12
+ # elements. All of the select-type methods share a number of common options that are as follows:
13
13
  #
14
14
  # * <tt>:prefix</tt> - overwrites the default prefix of "date" used for the select names. So specifying "birthday"
15
15
  # would give birthday[month] instead of date[month] if passed to the <tt>select_month</tt> method.
@@ -18,7 +18,7 @@ module ActionView
18
18
  # the <tt>select_month</tt> method would use simply "date" (which can be overwritten using <tt>:prefix</tt>) instead
19
19
  # of "date[month]".
20
20
  module DateHelper
21
- # Reports the approximate distance in time between two Time or Date objects or integers as seconds.
21
+ # Reports the approximate distance in time between two Time, Date or DateTime objects or integers as seconds.
22
22
  # Set <tt>include_seconds</tt> to true if you want more detailed approximations when distance < 1 min, 29 secs.
23
23
  # Distances are reported based on the following table:
24
24
  #
@@ -176,37 +176,37 @@ module ActionView
176
176
  # NOTE: Discarded selects will default to 1. So if no month select is available, January will be assumed.
177
177
  #
178
178
  # ==== Examples
179
- # # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute.
180
- # date_select("post", "written_on")
179
+ # # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute.
180
+ # date_select("article", "written_on")
181
181
  #
182
- # # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute,
182
+ # # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute,
183
183
  # # with the year in the year drop down box starting at 1995.
184
- # date_select("post", "written_on", :start_year => 1995)
184
+ # date_select("article", "written_on", :start_year => 1995)
185
185
  #
186
- # # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute,
186
+ # # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute,
187
187
  # # with the year in the year drop down box starting at 1995, numbers used for months instead of words,
188
188
  # # and without a day select box.
189
- # date_select("post", "written_on", :start_year => 1995, :use_month_numbers => true,
189
+ # date_select("article", "written_on", :start_year => 1995, :use_month_numbers => true,
190
190
  # :discard_day => true, :include_blank => true)
191
191
  #
192
- # # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute
192
+ # # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute
193
193
  # # with the fields ordered as day, month, year rather than month, day, year.
194
- # date_select("post", "written_on", :order => [:day, :month, :year])
194
+ # date_select("article", "written_on", :order => [:day, :month, :year])
195
195
  #
196
196
  # # Generates a date select that when POSTed is stored in the user variable, in the birthday attribute
197
197
  # # lacking a year field.
198
198
  # date_select("user", "birthday", :order => [:month, :day])
199
199
  #
200
- # # Generates a date select that when POSTed is stored in the post variable, in the written_on attribute
200
+ # # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute
201
201
  # # which is initially set to the date 3 days from the current date
202
- # date_select("post", "written_on", :default => 3.days.from_now)
202
+ # date_select("article", "written_on", :default => 3.days.from_now)
203
203
  #
204
204
  # # Generates a date select that when POSTed is stored in the credit_card variable, in the bill_due attribute
205
205
  # # that will have a default day of 20.
206
206
  # date_select("credit_card", "bill_due", :default => { :day => 20 })
207
207
  #
208
208
  # # Generates a date select with custom prompts.
209
- # date_select("post", "written_on", :prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year' })
209
+ # date_select("article", "written_on", :prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year' })
210
210
  #
211
211
  # The selects are prepared for multi-parameter assignment to an Active Record object.
212
212
  #
@@ -228,20 +228,20 @@ module ActionView
228
228
  # If anything is passed in the html_options hash it will be applied to every select tag in the set.
229
229
  #
230
230
  # ==== Examples
231
- # # Creates a time select tag that, when POSTed, will be stored in the post variable in the sunrise attribute.
232
- # time_select("post", "sunrise")
231
+ # # Creates a time select tag that, when POSTed, will be stored in the article variable in the sunrise attribute.
232
+ # time_select("article", "sunrise")
233
233
  #
234
- # # Creates a time select tag with a seconds field that, when POSTed, will be stored in the post variables in
234
+ # # Creates a time select tag with a seconds field that, when POSTed, will be stored in the article variables in
235
235
  # # the sunrise attribute.
236
- # time_select("post", "start_time", :include_seconds => true)
236
+ # time_select("article", "start_time", :include_seconds => true)
237
237
  #
238
238
  # # You can set the <tt>:minute_step</tt> to 15 which will give you: 00, 15, 30 and 45.
239
239
  # time_select 'game', 'game_time', {:minute_step => 15}
240
240
  #
241
241
  # # Creates a time select tag with a custom prompt. Use <tt>:prompt => true</tt> for generic prompts.
242
- # time_select("post", "written_on", :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'})
243
- # time_select("post", "written_on", :prompt => {:hour => true}) # generic prompt for hours
244
- # time_select("post", "written_on", :prompt => true) # generic prompts for all
242
+ # time_select("article", "written_on", :prompt => {:hour => 'Choose hour', :minute => 'Choose minute', :second => 'Choose seconds'})
243
+ # time_select("article", "written_on", :prompt => {:hour => true}) # generic prompt for hours
244
+ # time_select("article", "written_on", :prompt => true) # generic prompts for all
245
245
  #
246
246
  # # You can set :ampm option to true which will show the hours as: 12 PM, 01 AM .. 11 PM.
247
247
  # time_select 'game', 'game_time', {:ampm => true}
@@ -261,36 +261,36 @@ module ActionView
261
261
  # If anything is passed in the html_options hash it will be applied to every select tag in the set.
262
262
  #
263
263
  # ==== Examples
264
- # # Generates a datetime select that, when POSTed, will be stored in the post variable in the written_on
264
+ # # Generates a datetime select that, when POSTed, will be stored in the article variable in the written_on
265
265
  # # attribute.
266
- # datetime_select("post", "written_on")
266
+ # datetime_select("article", "written_on")
267
267
  #
268
268
  # # Generates a datetime select with a year select that starts at 1995 that, when POSTed, will be stored in the
269
- # # post variable in the written_on attribute.
270
- # datetime_select("post", "written_on", :start_year => 1995)
269
+ # # article variable in the written_on attribute.
270
+ # datetime_select("article", "written_on", :start_year => 1995)
271
271
  #
272
272
  # # Generates a datetime select with a default value of 3 days from the current time that, when POSTed, will
273
273
  # # be stored in the trip variable in the departing attribute.
274
274
  # datetime_select("trip", "departing", :default => 3.days.from_now)
275
275
  #
276
276
  # # Generate a datetime select with hours in the AM/PM format
277
- # datetime_select("post", "written_on", :ampm => true)
277
+ # datetime_select("article", "written_on", :ampm => true)
278
278
  #
279
- # # Generates a datetime select that discards the type that, when POSTed, will be stored in the post variable
279
+ # # Generates a datetime select that discards the type that, when POSTed, will be stored in the article variable
280
280
  # # as the written_on attribute.
281
- # datetime_select("post", "written_on", :discard_type => true)
281
+ # datetime_select("article", "written_on", :discard_type => true)
282
282
  #
283
283
  # # Generates a datetime select with a custom prompt. Use <tt>:prompt => true</tt> for generic prompts.
284
- # datetime_select("post", "written_on", :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year'})
285
- # datetime_select("post", "written_on", :prompt => {:hour => true}) # generic prompt for hours
286
- # datetime_select("post", "written_on", :prompt => true) # generic prompts for all
284
+ # datetime_select("article", "written_on", :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year'})
285
+ # datetime_select("article", "written_on", :prompt => {:hour => true}) # generic prompt for hours
286
+ # datetime_select("article", "written_on", :prompt => true) # generic prompts for all
287
287
  #
288
288
  # The selects are prepared for multi-parameter assignment to an Active Record object.
289
289
  def datetime_select(object_name, method, options = {}, html_options = {})
290
290
  InstanceTag.new(object_name, method, self, options.delete(:object)).to_datetime_select_tag(options, html_options)
291
291
  end
292
292
 
293
- # Returns a set of html select-tags (one for year, month, day, hour, and minute) pre-selected with the
293
+ # Returns a set of html select-tags (one for year, month, day, hour, minute and second) pre-selected with the
294
294
  # +datetime+. It's also possible to explicitly set the order of the tags using the <tt>:order</tt> option with
295
295
  # an array of symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order. If you do not
296
296
  # supply a Symbol, it will be appended onto the <tt>:order</tt> passed in. You can also add
@@ -343,15 +343,15 @@ module ActionView
343
343
 
344
344
  # Returns a set of html select-tags (one for year, month, and day) pre-selected with the +date+.
345
345
  # It's possible to explicitly set the order of the tags using the <tt>:order</tt> option with an array of
346
- # symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order. If you do not supply a Symbol,
347
- # it will be appended onto the <tt>:order</tt> passed in.
346
+ # symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order.
347
+ # If the array passed to the <tt>:order</tt> option does not contain all the three symbols, all tags will be hidden.
348
348
  #
349
349
  # If anything is passed in the html_options hash it will be applied to every select tag in the set.
350
350
  #
351
351
  # ==== Examples
352
- # my_date = Time.today + 6.days
352
+ # my_date = Time.now + 6.days
353
353
  #
354
- # # Generates a date select that defaults to the date in my_date (six days afteri today).
354
+ # # Generates a date select that defaults to the date in my_date (six days after today).
355
355
  # select_date(my_date)
356
356
  #
357
357
  # # Generates a date select that defaults to today (no specified date).
@@ -422,7 +422,7 @@ module ActionView
422
422
  end
423
423
 
424
424
  # Returns a select tag with options for each of the seconds 0 through 59 with the current second selected.
425
- # The <tt>second</tt> can also be substituted for a second number.
425
+ # The <tt>datetime</tt> can be either a +Time+ or +DateTime+ object or an integer.
426
426
  # Override the field name using the <tt>:field_name</tt> option, 'second' by default.
427
427
  #
428
428
  # ==== Examples
@@ -440,7 +440,7 @@ module ActionView
440
440
  #
441
441
  # # Generates a select field for seconds with a custom prompt. Use <tt>:prompt => true</tt> for a
442
442
  # # generic prompt.
443
- # select_minute(14, :prompt => 'Choose seconds')
443
+ # select_second(14, :prompt => 'Choose seconds')
444
444
  #
445
445
  def select_second(datetime, options = {}, html_options = {})
446
446
  DateTimeSelector.new(datetime, options, html_options).select_second
@@ -448,21 +448,21 @@ module ActionView
448
448
 
449
449
  # Returns a select tag with options for each of the minutes 0 through 59 with the current minute selected.
450
450
  # Also can return a select tag with options by <tt>minute_step</tt> from 0 through 59 with the 00 minute
451
- # selected. The <tt>minute</tt> can also be substituted for a minute number.
451
+ # selected. The <tt>datetime</tt> can be either a +Time+ or +DateTime+ object or an integer.
452
452
  # Override the field name using the <tt>:field_name</tt> option, 'minute' by default.
453
453
  #
454
454
  # ==== Examples
455
455
  # my_time = Time.now + 6.hours
456
456
  #
457
- # # Generates a select field for minutes that defaults to the minutes for the time in my_tiime.
457
+ # # Generates a select field for minutes that defaults to the minutes for the time in my_time.
458
458
  # select_minute(my_time)
459
459
  #
460
460
  # # Generates a select field for minutes that defaults to the number given.
461
461
  # select_minute(14)
462
462
  #
463
463
  # # Generates a select field for minutes that defaults to the minutes for the time in my_time
464
- # # that is named 'stride' rather than 'second'.
465
- # select_minute(my_time, :field_name => 'stride')
464
+ # # that is named 'moment' rather than 'minute'.
465
+ # select_minute(my_time, :field_name => 'moment')
466
466
  #
467
467
  # # Generates a select field for minutes with a custom prompt. Use <tt>:prompt => true</tt> for a
468
468
  # # generic prompt.
@@ -473,7 +473,7 @@ module ActionView
473
473
  end
474
474
 
475
475
  # Returns a select tag with options for each of the hours 0 through 23 with the current hour selected.
476
- # The <tt>hour</tt> can also be substituted for a hour number.
476
+ # The <tt>datetime</tt> can be either a +Time+ or +DateTime+ object or an integer.
477
477
  # Override the field name using the <tt>:field_name</tt> option, 'hour' by default.
478
478
  #
479
479
  # ==== Examples
@@ -485,8 +485,8 @@ module ActionView
485
485
  # # Generates a select field for hours that defaults to the number given.
486
486
  # select_hour(13)
487
487
  #
488
- # # Generates a select field for hours that defaults to the minutes for the time in my_time
489
- # # that is named 'stride' rather than 'second'.
488
+ # # Generates a select field for hours that defaults to the hour for the time in my_time
489
+ # # that is named 'stride' rather than 'hour'.
490
490
  # select_hour(my_time, :field_name => 'stride')
491
491
  #
492
492
  # # Generates a select field for hours with a custom prompt. Use <tt>:prompt => true</tt> for a
@@ -501,11 +501,11 @@ module ActionView
501
501
  end
502
502
 
503
503
  # Returns a select tag with options for each of the days 1 through 31 with the current day selected.
504
- # The <tt>date</tt> can also be substituted for a hour number.
504
+ # The <tt>date</tt> can also be substituted for a day number.
505
505
  # Override the field name using the <tt>:field_name</tt> option, 'day' by default.
506
506
  #
507
507
  # ==== Examples
508
- # my_date = Time.today + 2.days
508
+ # my_date = Time.now + 2.days
509
509
  #
510
510
  # # Generates a select field for days that defaults to the day for the date in my_date.
511
511
  # select_day(my_time)