Sha256: a7fac49e659c7ae43eb0df7e1d5da4a409f5533aa8fa8a6cba1fad1a0b02239c
Contents?: true
Size: 772 Bytes
Versions: 3
Compression:
Stored size: 772 Bytes
Contents
# encoding: utf-8 class EsrFile < ActiveRecord::Base # Access restrictions attr_accessible :file, :remarks # Default sorting default_scope order('created_at DESC') # File upload mount_uploader :file, EsrFileUploader validates :file, :presence => true has_many :esr_records, :dependent => :destroy # String 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vesr-1.0.0 | app/models/esr_file.rb |
vesr-0.13.1 | app/models/esr_file.rb |
vesr-0.13.0 | app/models/esr_file.rb |