comma-csv / comma

Comma is a small CSV (ie. comma separated values) generation extension for Ruby objects, that lets you seamlessly define a CSV output format via a small DSL

Home Page:https://github.com/comma-csv/comma

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DEPRECATION WARNING: class_inheritable_attribute is deprecated

threadhead opened this issue · comments

When using under Rails 3.1, the following dep warning will be displayed:

DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <top (required)> at /Users/karl/lazerwiz/config/application.rb:7)

The offending line is in lib/comma.rb:5

Not sure how to fix it.

I got rid of this message by changing the following:

diff --git a/lib/comma/object.rb b/lib/comma/object.rb
index 83cad11..93a06ee 100644
--- a/lib/comma/object.rb
+++ b/lib/comma/object.rb
@@ -1,5 +1,5 @@
 class Object
-  class_inheritable_accessor :comma_formats
+  class_attribute :comma_formats

   def self.comma(style = :default, &block)
     (self.comma_formats ||= {})[style] = block

I have submitted a pull request to fix this issue:
https://github.com/crafterm/comma/pull/25