Skip to content
Browse files

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

…b_test("show_some_element") %> ... <% end %>
  • Loading branch information...
1 parent a120f95 commit a328f34e504f205930851bd843aeed129ba79630 @patio11 patio11 committed Aug 16, 2009
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/abingo_view_helper.rb
View
9 lib/abingo_view_helper.rb
@@ -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 = {})

0 comments on commit a328f34

Please sign in to comment.
Something went wrong with that request. Please try again.