Module: Microservice::Concerns::EntityModel
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/microservice/concerns/entity_model.rb
Overview
Example of migration:
create_table :table_name, force: true do |t|
t.string :name, null: false
t.text :description, null: true
t.boolean :active, null: false, default: true
t.references :author, null: false
t.references :updated_by, null: true
t. null: false
end
Instance Method Summary collapse
- #class_route_array ⇒ Object
- #css_class(options = {}) ⇒ Object
- #last_touch_by ⇒ Object
- #model_route_array ⇒ Object
- #parent_entity ⇒ Object
- #parent_entity=(value) ⇒ Object
- #polymorphic_class ⇒ Object
- #to_form_path ⇒ Object
Instance Method Details
#class_route_array ⇒ Object
104 105 106 |
# File 'app/models/microservice/concerns/entity_model.rb', line 104 def class_route_array self.class.class_route_array end |
#css_class(options = {}) ⇒ Object
84 85 86 |
# File 'app/models/microservice/concerns/entity_model.rb', line 84 def css_class( = {}) self.class.css_class() end |
#last_touch_by ⇒ Object
112 113 114 |
# File 'app/models/microservice/concerns/entity_model.rb', line 112 def last_touch_by updated_by || end |
#model_route_array ⇒ Object
100 101 102 |
# File 'app/models/microservice/concerns/entity_model.rb', line 100 def model_route_array [self.namespace, self.parent_entity, polymorphic_class] end |
#parent_entity ⇒ Object
88 89 90 |
# File 'app/models/microservice/concerns/entity_model.rb', line 88 def parent_entity send(parent_entity_symbol) if parent_entity_symbol end |
#parent_entity=(value) ⇒ Object
92 93 94 |
# File 'app/models/microservice/concerns/entity_model.rb', line 92 def parent_entity=(value) send(parent_entity_symbol.to_s + '=', value) if parent_entity_symbol end |
#polymorphic_class ⇒ Object
96 97 98 |
# File 'app/models/microservice/concerns/entity_model.rb', line 96 def polymorphic_class self.becomes(self.class.base_class) end |
#to_form_path ⇒ Object
108 109 110 |
# File 'app/models/microservice/concerns/entity_model.rb', line 108 def to_form_path self.class._to_form_path end |