lib/bankserv/transmission/set.rb in bankserv-0.2.1 vs lib/bankserv/transmission/set.rb in bankserv-0.2.2
- old
+ new
@@ -1,12 +1,12 @@
module Bankserv
class Set < ActiveRecord::Base
belongs_to :set
+ belongs_to :document
has_many :sets
- has_one :document
has_many :records
def build_header(options = {})
records.build(record_type: "header", data: options)
end
@@ -41,10 +41,10 @@
klass = "Absa::H2h::Transmission::#{set_type.camelize}".constantize
records.each do |record|
defaults = klass.record_type(record.record_type).template_options
record.data = defaults.merge(record.data)
- record.data[:rec_status] = rec_status unless record.data[:rec_status]
+ record.data[:rec_status] ||= rec_status
end
self.records.each{|rec| rec.save!} # TODO: does this cause records to save before set?
end
\ No newline at end of file