Sha256: 9ce2798d9acb71e5a365f872dc00805e63787216d3b720080d70ca3ba64860fb
Contents?: true
Size: 1.47 KB
Versions: 7
Compression:
Stored size: 1.47 KB
Contents
module KirguduBase module Settings class Value < ::KirguduBase::BaseModel ########################################## RELATIONS ######################################## include ::KirguduBase::Models::BasicProperties::Portal include ::KirguduBase::Models::BasicProperties::CreatedBy include ::KirguduBase::Models::BasicProperties::UpdatedBy belongs_to :option, class_name: ::KirguduBase::Settings::Option, foreign_key: :option_id ########################################## VALIDATIONS ####################################### #validates_presence_of :option_id #validates_numericality_of :data, if: @option && @option.value_type_id == ::Core::Common::DataType.id_by_tag('integer'), allow_null: true #validates_inclusion_of :data, :in => [true, false], if: @option && @option.value_type_id == ::Core::Common::DataType.id_by_tag('boolean'), allow_null: true #validates_date_of :data, if: @option && @option.value_type_id == ::Core::Common::DataType.id_by_tag('date'), allow_null: true #validates_datetime :data, if: @option && @option.value_type_id == ::Core::Common::DataType.id_by_tag('datetime'), allow_null: true #validates_presence_of :data, if: option.allow_null? ######################################### SCOPES ############################################# def option_name option.name if option end def load_option @option = ::KirguduBase::Settings::Option.where(id: self.option_id).first if self.option_id end end end end
Version data entries
7 entries across 7 versions & 1 rubygems