I have the following Product class which is raising an uninitialized constant Product::CSV exception.
class Product < ActiveRecord::Base   has_attached_file :photo, :styles => { :small => "150*150>" }    def self.import(file)       CSV.foreach(file.path, headers: true) do |row|         product = find_by_id(row["id"]) || new         product.attributes = row.to_hash.slice(*accessible_attributes)         product.save!       end     end   end 
                You need to require the CSV library.
require 'csv'  class Product < ActiveRecord::Base    # ... end 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With