aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/tags/select.rb
diff options
context:
space:
mode:
authorBogdan Gusiev <agresso@gmail.com>2013-09-23 14:25:42 +0300
committerBogdan Gusiev <agresso@gmail.com>2013-09-23 14:25:42 +0300
commit57bf92c6de125adc45bb006115d22d07270618b3 (patch)
tree64c3ee73bfd5655877e94ff690cb2e6f0e13d6c8 /actionview/lib/action_view/helpers/tags/select.rb
parentd58b720f596cf87bf44dbd86b8a573b081ef6268 (diff)
downloadrails-57bf92c6de125adc45bb006115d22d07270618b3.tar.gz
rails-57bf92c6de125adc45bb006115d22d07270618b3.tar.bz2
rails-57bf92c6de125adc45bb006115d22d07270618b3.zip
Ability to pass block to AV#select helper
Example: = select(report, "campaign_ids") do - available_campaigns.each do |c| %option{:data => {:tags => c.tags.to_json}, :value => c.id}= c.name
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)