Sha256: f3b66a3827d1b3d6f50a310ed62baa3dd4158808ce3c37403dbd458621170b33
Contents?: true
Size: 635 Bytes
Versions: 1
Compression:
Stored size: 635 Bytes
Contents
# # Simply extracted some code to clean up model. # I'd like to do this to all of the really big classes # but let's see how this goes first. # module StudySubjectRaces def self.included(base) # Must delay the calls to these ActiveRecord methods # or it will raise many "undefined method"s. base.class_eval do has_many :subject_races has_many :races, :through => :subject_races accepts_nested_attributes_for :subject_races, :allow_destroy => true, :reject_if => proc{|attributes| attributes['race_id'].blank? } def race_names races.collect(&:to_s).join(', ') end end # class_eval end # included end # StudySubjectRaces
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ccls-ccls_engine-3.11.0 | app/models/study_subject_races.rb |