Sha256: b0054ea11a96ec8bc2a54cc2cc5937c5abac036d3f80d367e93a2d8686e6cb2d

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 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 StudySubjectInterviews
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 :interviews

	#	Returns home exposures interview
	def hx_interview
		interviews.find(:first,
#			:conditions => "projects.key = 'HomeExposures'",
			:conditions => { 'projects.id' => Project['HomeExposures'].id },
			:joins => [:instrument_version => [:instrument => :project]]
		)
	end

end	#	class_eval
end	#	included
end	#	StudySubjectInterviews

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ccls-ccls_engine-3.11.0 app/models/study_subject_interviews.rb