scinote-web/app/models/sample_custom_field.rb

13 lines
401 B
Ruby
Raw Normal View History

2016-02-12 23:52:43 +08:00
class SampleCustomField < ActiveRecord::Base
2017-04-11 20:55:44 +08:00
include SearchableModel
auto_strip_attributes :value, nullify: false
validates :value,
presence: true,
length: { maximum: Constants::NAME_MAX_LENGTH }
2016-02-12 23:52:43 +08:00
validates :custom_field, :sample, presence: true
belongs_to :custom_field, inverse_of: :sample_custom_fields
belongs_to :sample, inverse_of: :sample_custom_fields
end