datamapper / dm-types

DataMapper plugin providing extra data types
http://datamapper.org/
MIT License
55 stars 80 forks source link

dm-types redefines the global CSV constant on Ruby 1.8 #51

Closed rsutphin closed 8 years ago

rsutphin commented 12 years ago

dm-types/csv.rb redefines the global CSV constant to be an alias to FasterCSV when running under Ruby 1.8. While I understand the desire to keep the remainder of the code the same under 1.8 and 1.9, this causes a problem: if the built-in CSV library is required after dm-types/csv.rb (e.g., by another library) you get a superclass mismatch for class Row error.

An alternative: define a method on that returns the appropriate module to use (CSV or FasterCSV) depending on the ruby version.

dm-serializer has a similar bug (datamapper/dm-serializer#25). The bug in dm-types is less serious since dm-types/csv.rb is only required if you actually use the Csv type, but it is still a potential issue.

solnic commented 12 years ago

We'll resolve this problem for 1.3.0 release. Thanks for reporting the issue.

glennr commented 12 years ago

+1

tpitale commented 8 years ago

Does anyone still need this? Ruby 1.8 (and 1.9 for that matter) are unsupported any longer. I'm not sure we have the people to maintain support for these versions. If you are still using 1.8 please leave a comment and I'll reopen.