This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Location < ActiveRecord::Base | |
has_many :foos | |
acts_as_mappable default_units: :kms | |
end | |
class Foo < ActiveRecord::Base | |
belongs_to :location | |
acts_as_mappable through: :location | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse filename, content | |
offset = 0 | |
begin | |
FasterCSV.parse(content) do |row| | |
# do stuff | |
offset += row.to_s.size | |
end | |
rescue FasterCSV::MalformedCSVError => e | |
@file_offset ||= 0 | |
@file_offset += offset |
NewerOlder