Class: Appfuel::Db::ActiveRecordModel
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Appfuel::Db::ActiveRecordModel
- Includes:
- Application::AppContainer
- Defined in:
- lib/appfuel/storage/db/active_record_model.rb
Overview
ActiveRecord::Base that auto registers itself into the application container and symbolizes its attributes. This is used by the db mapper to persist and retreive domains to and from the database.
NOTE: we are coupling ourselves to active record right now. I have
plans to resolve this but right now its a lower priority. You
can get around this by implementing your own mapper, and db model.
Class Method Summary collapse
-
.container_class_type ⇒ String
Contributes to the construction of a fully qualified container key.
-
.inherited(klass) ⇒ Object
Registers the class inside the application container.
Instance Method Summary collapse
-
#domain_attrs ⇒ Hash
Symbolize active record attributes and remove attributes with nil values.
Methods included from Application::AppContainer
#app_container, #feature_name, included, #qualify_container_key
Class Method Details
.container_class_type ⇒ String
Contributes to the construction of a fully qualified container key
23 24 25 |
# File 'lib/appfuel/storage/db/active_record_model.rb', line 23 def self.container_class_type 'db' end |
.inherited(klass) ⇒ Object
Registers the class inside the application container. The class being registered as the mixin required for registration.
32 33 34 35 |
# File 'lib/appfuel/storage/db/active_record_model.rb', line 32 def self.inherited(klass) stage_class_for_registration(klass) super end |
Instance Method Details
#domain_attrs ⇒ Hash
Symbolize active record attributes and remove attributes with nil values
41 42 43 |
# File 'lib/appfuel/storage/db/active_record_model.rb', line 41 def domain_attrs attributes.symbolize_keys.select {|_k, v| !v.nil? } end |