Skip to content

Instantly share code, notes, and snippets.

View tsujigiri's full-sized avatar
👋
I'm GitHubbing!

Helge Rausch tsujigiri

👋
I'm GitHubbing!
View GitHub Profile
@tsujigiri
tsujigiri / mcmire-geokit-rails3.rb
Created May 23, 2011 06:30
mcmire's Geokit branch
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
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