Sha256: 6f89137bab4eef8c81687804ed8312248524ddcd437ebb70202e5c117dbe37c0

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

class IcfMasterId < ActiveRecordShared

#+------------------+------------+------+-----+---------+----------------+
#| Field            | Type       | Null | Key | Default | Extra          |
#+------------------+------------+------+-----+---------+----------------+
#| id               | int(11)    | NO   | PRI | NULL    | auto_increment |
#| icf_master_id    | varchar(9) | YES  | UNI | NULL    |                |
#| assigned_on      | date       | YES  |     | NULL    |                |
#| created_at       | datetime   | YES  |     | NULL    |                |
#| updated_at       | datetime   | YES  |     | NULL    |                |
#| study_subject_id | int(11)    | YES  | UNI | NULL    |                |
#+------------------+------------+------+-----+---------+----------------+

	belongs_to :study_subject
  attr_protected( :study_subject_id, :study_subject )

#	probably shouldn't add validations as this won't be created by users. yet.

	def to_s
		icf_master_id
	end

#	a named scope would be nice but
	def self.next_unused
		find(:first,
			:conditions => ['study_subject_id IS NULL']
		)
	end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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