Class: ActiveRecordCompose::Model
- Inherits:
-
Object
- Object
- ActiveRecordCompose::Model
- Includes:
- ActiveModel::Attributes, ActiveModel::Model, AttributeQuerying, Callbacks, DelegateAttribute, Persistence, Validations
- Defined in:
- lib/active_record_compose/model.rb
Constant Summary
Constants included from DelegateAttribute
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Model
constructor
A new instance of Model.
-
#persisted? ⇒ Boolean
Returns true if model is persisted.
Methods included from Validations
Methods included from Persistence
#save, #save!, #update, #update!
Methods included from TransactionSupport
#id, #restore_transaction_record_state, #trigger_transactional_callbacks?
Methods included from DelegateAttribute
Constructor Details
#initialize(attributes = {}) ⇒ Model
Returns a new instance of Model.
22 23 24 |
# File 'lib/active_record_compose/model.rb', line 22 def initialize(attributes = {}) super end |
Instance Method Details
#persisted? ⇒ Boolean
Returns true if model is persisted.
By overriding this definition, you can control the callbacks that are triggered when a save is made. For example, returning false will trigger before_create, around_create and after_create, and returning true will trigger before_update, around_update and after_update.
33 |
# File 'lib/active_record_compose/model.rb', line 33 def persisted? = super |