Sha256: 475f561685087fd3efc989982d79a9ef7fbd37e9af18ea98042232d6b243b4e6
Contents?: true
Size: 586 Bytes
Versions: 2
Compression:
Stored size: 586 Bytes
Contents
class EsrFile < ActiveRecord::Base # File upload mount_uploader :file, EsrFileUploader has_many :esr_records, :dependent => :destroy def to_s(format = :default) case format when :long s = '' esr_records.each {|record| s += record.to_s + "\n" } s else "#{updated_at.strftime('%d.%m.%Y')}: #{file_identifier}" end end after_save :create_records private def create_records File.new(file.current_path).each {|line| self.esr_records << EsrRecord.new.parse(line) unless line[0..2] == '999' } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vesr-0.12.5 | app/models/esr_file.rb |
vesr-0.12.4 | app/models/esr_file.rb |