Class: Ml::Model
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Ml::Model
- Includes:
- Presentable
- Defined in:
- app/models/ml/model.rb
Constant Summary
Constants inherited from ApplicationRecord
Constants included from ResetOnUnionError
ResetOnUnionError::MAX_RESET_PERIOD
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Presentable
Methods inherited from ApplicationRecord
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from SensitiveSerializableHash
Class Method Details
.find_or_create(project, name, experiment) ⇒ Object
31 32 33 34 |
# File 'app/models/ml/model.rb', line 31 def self.find_or_create(project, name, experiment) create_with(default_experiment: experiment) .find_or_create_by(project: project, name: name) end |
Instance Method Details
#valid_default_experiment? ⇒ Boolean
24 25 26 27 28 29 |
# File 'app/models/ml/model.rb', line 24 def valid_default_experiment? return unless default_experiment errors.add(:default_experiment) unless default_experiment.name == name errors.add(:default_experiment) unless default_experiment.project_id == project_id end |