Bug #15662

Fix CSV delegation to missing StringIO

Added by gsamokovarov (Genadi Samokovarov) almost 2 years ago. Updated almost 2 years ago.

Target version:


If you create a CSV from raw content like:

  csv ="h1,h2")

You'll get method missing when calling csv.path but still, get true when you call csv.respond_to?(:path).

This tricks 3rd party libraries like carrierwave which try to call path on their input if it responds to it.


This stops me from passing CSV objects as StringIO's into carrierwave uploads, for example, but the problem can also be manifested in other 3rd party libraries, as responding to a method and returning a NoMethodError when calling it is still an unexpected behavior.

I have gone through the CSV delegation scheme and made sure that every method that StringIO doesn't respond to returns a meaningful zero value and does not raise a NoMethodError while used through a CSV Instance.

Updated by gsamokovarov (Genadi Samokovarov) almost 2 years ago

I have opened a PR on GitHub's tracker with the changes:

Updated by kou (Kouhei Sutou) almost 2 years ago

  • Assignee set to kou (Kouhei Sutou)
  • Status changed from Open to Assigned

Could you use instead of ruby/ruby?
ruby/csv is the upstream repository.

Updated by kou (Kouhei Sutou) almost 2 years ago

  • Status changed from Assigned to Closed


Also available in: Atom PDF