2017-06-23 21:19:08 +08:00
|
|
|
class SampleCustomField < ApplicationRecord
|
2017-04-11 20:55:44 +08:00
|
|
|
include SearchableModel
|
|
|
|
|
2016-09-21 21:35:23 +08:00
|
|
|
auto_strip_attributes :value, nullify: false
|
2016-10-05 23:45:20 +08:00
|
|
|
validates :value,
|
|
|
|
presence: true,
|
|
|
|
length: { maximum: Constants::NAME_MAX_LENGTH }
|
2016-02-12 23:52:43 +08:00
|
|
|
validates :custom_field, :sample, presence: true
|
|
|
|
|
2017-06-28 21:21:32 +08:00
|
|
|
belongs_to :custom_field, inverse_of: :sample_custom_fields, optional: true
|
|
|
|
belongs_to :sample, inverse_of: :sample_custom_fields, optional: true
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|