Class: ActiveRecordCompose::Model
- Inherits:
-
Object
- Object
- ActiveRecordCompose::Model
show all
- Extended by:
- ActiveModel::Attributes::ClassMethods, ActiveModel::Callbacks, ActiveModel::Validations::Callbacks::ClassMethods, ActiveModel::Validations::ClassMethods
- Includes:
- ActiveModel::Attributes, ActiveModel::Model, ActiveModel::Validations::Callbacks, Attributes, Callbacks, Inspectable, Persistence, TransactionSupport, Validations
- Defined in:
- lib/active_record_compose/model.rb,
sig/active_record_compose.rbs,
sig/_internal/package_private.rbs
Overview
This is the core class of ActiveRecordCompose.
By defining subclasses of this model, you can use ActiveRecordCompose functionality in your application.
It has the basic functionality of ActiveModel::Model and ActiveModel::Attributes,
and also provides aggregation of multiple models and atomic updates through transaction control.
Class Method Summary
collapse
Instance Method Summary
collapse
inspection_filter
Methods included from Attributes
#_require_attributes_initialized, #_write_attribute, #attribute, #attribute_names, #attributes, delegated_attributes, #delegated_attributes, delegated_attributes=
#_run_before_commit_callbacks, #_run_commit_callbacks, #_run_rollback_callbacks
#errors, #valid?, #validate, #validate!
Constructor Details
#initialize(attributes = {}) ⇒ Model
Returns a new instance of Model.
92
93
94
|
# File 'lib/active_record_compose/model.rb', line 92
def initialize(attributes = {})
super
end
|
Class Method Details
.after_commit ⇒ void
This method returns an undefined value.
75
|
# File 'sig/active_record_compose.rbs', line 75
def self.after_commit: (*callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.after_create ⇒ void
This method returns an undefined value.
68
|
# File 'sig/active_record_compose.rbs', line 68
def self.after_create: (*callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.after_rollback ⇒ void
This method returns an undefined value.
76
|
# File 'sig/active_record_compose.rbs', line 76
def self.after_rollback: (*callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.after_save ⇒ void
This method returns an undefined value.
64
|
# File 'sig/active_record_compose.rbs', line 64
def self.after_save: (*callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.after_update ⇒ void
This method returns an undefined value.
72
|
# File 'sig/active_record_compose.rbs', line 72
def self.after_update: (*callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.around_create ⇒ void
This method returns an undefined value.
67
|
# File 'sig/active_record_compose.rbs', line 67
def self.around_create: (*around_callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.around_save ⇒ void
This method returns an undefined value.
63
|
# File 'sig/active_record_compose.rbs', line 63
def self.around_save: (*around_callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.around_update ⇒ void
This method returns an undefined value.
71
|
# File 'sig/active_record_compose.rbs', line 71
def self.around_update: (*around_callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.before_commit ⇒ void
This method returns an undefined value.
74
|
# File 'sig/active_record_compose.rbs', line 74
def self.before_commit: (*callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.before_create ⇒ void
This method returns an undefined value.
66
|
# File 'sig/active_record_compose.rbs', line 66
def self.before_create: (*callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.before_save ⇒ void
This method returns an undefined value.
62
|
# File 'sig/active_record_compose.rbs', line 62
def self.before_save: (*callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.before_update ⇒ void
This method returns an undefined value.
70
|
# File 'sig/active_record_compose.rbs', line 70
def self.before_update: (*callback[instance], ?if: condition[instance], ?unless: condition[instance], **untyped) ?{ () [self: instance] -> void } -> void
|
.delegate_attribute ⇒ Object
78
|
# File 'sig/active_record_compose.rbs', line 78
def self.delegate_attribute: (*untyped methods, to: untyped, ?allow_nil: bool) -> untyped
|
.filter_attributes ⇒ Array[untyped]
80
|
# File 'sig/active_record_compose.rbs', line 80
def self.filter_attributes: () -> Array[untyped]
|
.filter_attributes= ⇒ Object
81
|
# File 'sig/active_record_compose.rbs', line 81
def self.filter_attributes=: (Array[untyped]) -> untyped
|
Instance Method Details
#id ⇒ Object
Returns the ID value. This value is used when passing it to the :model option of form_with, etc.
Normally it returns nil, but it can be overridden to delegate to the containing model.
117
|
# File 'lib/active_record_compose/model.rb', line 117
def id = nil
|
#inspect ⇒ String
91
|
# File 'sig/active_record_compose.rbs', line 91
def inspect: () -> String
|
Returns a collection of model elements to encapsulate.
#override_validation_context ⇒ validation_context
112
|
# File 'sig/_internal/package_private.rbs', line 112
def override_validation_context: -> validation_context
|
#pretty_print ⇒ void
This method returns an undefined value.
92
|
# File 'sig/active_record_compose.rbs', line 92
def pretty_print: (untyped q) -> void
|
#save ⇒ Boolean
84
|
# File 'sig/active_record_compose.rbs', line 84
def save: (**untyped options) -> bool
|
#save! ⇒ Object
85
|
# File 'sig/active_record_compose.rbs', line 85
def save!: (**untyped options) -> untyped
|
#update ⇒ Boolean
86
|
# File 'sig/active_record_compose.rbs', line 86
def update: (Hash[attribute_name, untyped]) -> bool
|
#update! ⇒ Object
87
|
# File 'sig/active_record_compose.rbs', line 87
def update!: (Hash[attribute_name, untyped]) -> untyped
|
#validate_models ⇒ void
This method returns an undefined value.
111
|
# File 'sig/_internal/package_private.rbs', line 111
def validate_models: -> void
|