recipe/show fails if there are leading spaces in ingredient quantities:
ActionView::TemplateError (private method `split' called for nil:NilClass) on line
#55 of app/views/recipe/show.rhtml:
52: if tmp_qty =~ /\//
53: if tmp_qty.include?(" ")
54: qty_str += tmp_qty.split(" ")[0]
55: qty_str += " <sup>#{tmp_qty.split("
")[1].split("/")[0]}</sup>/<sub>#{tmp_qty.split("
")[1].split("/")[1]}</sub>"
56: else
57: qty_str = "<sup>#{tmp_qty.split("/")[0]}</s
up>/<sub>#{tmp_qty.split("/")[1]}</sub>"
58: end
I worked around this by adding a 'tmp_qty.strip' after line 52. Ideally the leading and trailing spaces would never
be stored in the database, so the real fix should occur when ingredient quantities are accepted from the user or before
they are saved. |