diff options
author | jasl <jasl9187@hotmail.com> | 2013-01-02 16:48:09 +0800 |
---|---|---|
committer | jasl <jasl9187@hotmail.com> | 2013-01-02 16:48:09 +0800 |
commit | ea881ca85a1a9df3c25e2ee8668d98416a5c1acb (patch) | |
tree | 89cdf15778c579012e4453c4c6c9c358feee94f4 /actionpack/lib | |
parent | d38c8caa48a732d41c7402a5e71deece4e313559 (diff) | |
download | rails-ea881ca85a1a9df3c25e2ee8668d98416a5c1acb.tar.gz rails-ea881ca85a1a9df3c25e2ee8668d98416a5c1acb.tar.bz2 rails-ea881ca85a1a9df3c25e2ee8668d98416a5c1acb.zip |
fix block.arity raise nil error when not given a block to "content_tag_for"
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/record_tag_helper.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/record_tag_helper.rb b/actionpack/lib/action_view/helpers/record_tag_helper.rb index aae6389445..709b5d2c17 100644 --- a/actionpack/lib/action_view/helpers/record_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/record_tag_helper.rb @@ -98,7 +98,9 @@ module ActionView options, prefix = prefix, nil if prefix.is_a?(Hash) options = options ? options.dup : {} options.merge!(:class => "#{dom_class(record, prefix)} #{options[:class]}".strip, :id => dom_id(record, prefix)) - if block.arity == 0 + if !block_given? + content_tag(tag_name, "", options) + elsif block.arity == 0 content_tag(tag_name, capture(&block), options) else content_tag(tag_name, capture(record, &block), options) |