Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing view helper so that it works without blocks. Handy for <% if(a…

…b_test("show_some_element") %> ... <% end %>
  • Loading branch information...
commit a328f34e504f205930851bd843aeed129ba79630 1 parent a120f95
Patrick McKenzie patio11 authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/abingo_view_helper.rb
9 lib/abingo_view_helper.rb
View
@@ -22,8 +22,13 @@ def ab_test(test_name, alternatives = nil, options = {}, &block)
else
choice = Abingo.test(test_name, alternatives, options)
end
- content_tag = capture(choice, &block)
- block_called_from_erb?(block) ? concat(content_tag) : content_tag
+
+ if block
+ content_tag = capture(choice, &block)
+ block_called_from_erb?(block) ? concat(content_tag) : content_tag
+ else
+ choice
+ end
end
def bingo!(test_name, options = {})
Please sign in to comment.
Something went wrong with that request. Please try again.