Guest User

Untitled

a guest
May 27th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. <!-- Piece of erb code -->
  2. <% unless_error do %> # Error: wrong number of arguments (1 for 2)
  3. <p>Some HTML here</p>
  4. <% end %>
  5.  
  6.  
  7. # MyHelper.rb:
  8. def unless_error &block
  9. if flash[:error]
  10. concat "<p>#{flash[:error]}</p>"
  11. else
  12. # Execute given erb block:
  13. yield
  14. end
  15. end
  16.  
  17. # The problem is the error message on line 2.
Add Comment
Please, Sign In to add comment