Base class for all Engine models
abstract class PlaceOS::Model::ModelBase
- PlaceOS::Model::ModelBase
- PgORM::Base
- ActiveModel::Model
- Reference
- Object
Overview
Base class for all Engine models
Included Modules
- Neuroplastic
- PlaceOS::Model::Associations
Direct Known Subclasses
- PlaceOS::Model::ApiKey
- PlaceOS::Model::Asset
- PlaceOS::Model::AssetCategory
- PlaceOS::Model::AssetPurchaseOrder
- PlaceOS::Model::AssetType
- PlaceOS::Model::Authority
- PlaceOS::Model::Broker
- PlaceOS::Model::Chat
- PlaceOS::Model::ControlSystem
- PlaceOS::Model::Driver
- PlaceOS::Model::Edge
- PlaceOS::Model::JsonSchema
- PlaceOS::Model::LdapAuthentication
- PlaceOS::Model::Metadata
- PlaceOS::Model::Module
- PlaceOS::Model::OAuthAuthentication
- PlaceOS::Model::Playlist
- PlaceOS::Model::Playlist::Item
- PlaceOS::Model::Playlist::Revision
- PlaceOS::Model::Repository
- PlaceOS::Model::SamlAuthentication
- PlaceOS::Model::Settings
- PlaceOS::Model::Shortener
- PlaceOS::Model::Statistics
- PlaceOS::Model::Storage
- PlaceOS::Model::Trigger
- PlaceOS::Model::TriggerInstance
- PlaceOS::Model::Upload
- PlaceOS::Model::User
- PlaceOS::Model::UserAuthLookup
- PlaceOS::Model::Zone
Defined in:
placeos-models/base/model.crConstant Summary
-
CALLBACKS =
{before_save: [do if self.id? else self.id = Utilities::IdGenerator.next(self) end end] of Nil, after_save: [] of Nil, before_create: [do if self.id? else self.id = Utilities::IdGenerator.next(self) end end] of Nil, after_create: [] of Nil, before_update: [] of Nil, after_update: [] of Nil, before_destroy: [] of Nil, after_destroy: [] of Nil}
-
Base class for all Engine models
Constructors
-
.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
Base class for all Engine models
-
.new(pull : JSON::PullParser)
Base class for all Engine models
-
.new(rs : DB::ResultSet)
Base class for all Engine models
Class Method Summary
-
.attributes : Array(Symbol)
Returns all attribute keys.
-
.auto_generate_id : Bool
Base class for all Engine models
-
.from_rs(rs : DB::ResultSet)
Base class for all Engine models
-
.primary_key : Symbol
Base class for all Engine models
Instance Method Summary
-
#after_create
Base class for all Engine models
-
#after_destroy
Base class for all Engine models
-
#after_save
Base class for all Engine models
-
#after_update
Base class for all Engine models
-
#apply_defaults
Generate code to apply default values
-
#assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Assign to mulitple attributes via
HTTP::Params
. -
#assign_attributes(model : PlaceOS::Model::ModelBase)
Assign to multiple attributes from a model object
-
#assign_attributes
Assign to multiple attributes.
-
#attributes
Returns a
Hash
of all attribute values -
#attributes_tuple
Returns a
NamedTuple
of all attribute values. -
#before_create
Base class for all Engine models
-
#before_destroy
Base class for all Engine models
-
#before_save
Base class for all Engine models
-
#before_update
Base class for all Engine models
-
#invoke_props
Base class for all Engine models
-
#persistent_attributes
Returns a
Hash
of all attributes that can be persisted. -
#run_create_callbacks(&)
Wrap a block with callbacks for the appropriate crud operation
-
#run_destroy_callbacks(&)
Base class for all Engine models
-
#run_save_callbacks(&)
Base class for all Engine models
-
#run_update_callbacks(&)
Base class for all Engine models
Instance methods inherited from module PlaceOS::Model::Associations
format_list_for_postgres(list : Enumerable(String)) : String
format_list_for_postgres,
reset_associations
reset_associations
Class methods inherited from module PlaceOS::Model::Associations
format_list_for_postgres(list : Enumerable(String)) : String
format_list_for_postgres
Macros inherited from module PlaceOS::Model::Associations
belongs_to(parent_class, dependent = :none, association_name = nil, foreign_key = nil, presence = false, pk_type = nil, serialize = true)
belongs_to,
has_many(child_class, collection_name = nil, dependent = :none, foreign_key = nil, serialize = false)
has_many,
has_one(child_class, dependent = :none, association_name = nil, presence = false)
has_one
Constructor Detail
Class Method Detail
Instance Method Detail
Assign to mulitple attributes via HTTP::Params
.
Assign to multiple attributes from a model object