aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/tags/select.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-23 11:09:45 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-23 11:09:45 -0300
commit377641e90cbadc8ccd2d72e22862623072770aec (patch)
tree7e9100dee819e62d14f03b7f1c99a523c1266378 /actionview/lib/action_view/helpers/tags/select.rb
parent7ef29140eb67a8f1475ebde24c524d7ff35a2154 (diff)
parent57bf92c6de125adc45bb006115d22d07270618b3 (diff)
downloadrails-377641e90cbadc8ccd2d72e22862623072770aec.tar.gz
rails-377641e90cbadc8ccd2d72e22862623072770aec.tar.bz2
rails-377641e90cbadc8ccd2d72e22862623072770aec.zip
Merge pull request #11055 from bogdan/select-with-block
Ability to pass block to select form builder helper
Diffstat (limited to 'actionview/lib/action_view/helpers/tags/select.rb')
-rw-r--r--actionview/lib/action_view/helpers/tags/select.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/tags/select.rb b/actionview/lib/action_view/helpers/tags/select.rb
index d64e2f68ef..00881d9978 100644
--- a/actionview/lib/action_view/helpers/tags/select.rb
+++ b/actionview/lib/action_view/helpers/tags/select.rb
@@ -3,8 +3,9 @@ module ActionView
module Tags # :nodoc:
class Select < Base # :nodoc:
def initialize(object_name, method_name, template_object, choices, options, html_options)
- @choices = choices
+ @choices = block_given? ? template_object.capture { yield } : choices
@choices = @choices.to_a if @choices.is_a?(Range)
+
@html_options = html_options
super(object_name, method_name, template_object, options)