Class: KirguduBase::DynamicPages::Element
- Inherits:
-
Object
- Object
- KirguduBase::DynamicPages::Element
- Includes:
- ActiveModel::Validations, Models::FixableElements::InstanceMethods, Models::MergeableElements::InstanceMethods
- Defined in:
- app/models/kirgudu_base/dynamic_pages/element.rb
Direct Known Subclasses
KirguduBase::DynamicFilters::ObligatoryFilter, ControllerLink, ControllerLinkId, DataSource, Event, EventAction, EventActionConstraint, FormPropertiesNamedSet, ManagementSettings, Menu, Page, PageElement, ParentElement, Relation, SortingSettings, KirguduBase::DynamicTransactions::TransactionInjection
Instance Attribute Summary collapse
-
#parent_entry ⇒ Object
readonly
Returns the value of attribute parent_entry.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
- #fix_parent_entry(parent_entry) ⇒ Object
-
#initialize(options = {}) ⇒ Element
constructor
A new instance of Element.
- #kontroller_klass ⇒ Object
- #to_external_hash(options = {}) ⇒ Object
Methods included from Models::MergeableElements::ClassMethods
get_mergeable_attributes, mergeable_attributes
Methods included from Models::FixableElements::ClassMethods
fixable_attributes, get_kb_fixable_attributes
Methods included from Models::MergeableElements::InstanceMethods
Constructor Details
#initialize(options = {}) ⇒ Element
Returns a new instance of Element.
14 15 16 17 18 19 20 21 |
# File 'app/models/kirgudu_base/dynamic_pages/element.rb', line 14 def initialize( = {}) if .symbolize_keys! .each_pair do |key, value| self.send("#{key}=", value) end end end |
Instance Attribute Details
#parent_entry ⇒ Object
Returns the value of attribute parent_entry.
24 25 26 |
# File 'app/models/kirgudu_base/dynamic_pages/element.rb', line 24 def parent_entry @parent_entry end |
Instance Method Details
#as_json(options = {}) ⇒ Object
44 45 46 47 48 |
# File 'app/models/kirgudu_base/dynamic_pages/element.rb', line 44 def as_json( = {}) super(( || {}).merge({ :except => [:parent_entry, :validation_context, :errors] })) end |
#fix_parent_entry(parent_entry) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/models/kirgudu_base/dynamic_pages/element.rb', line 26 def fix_parent_entry(parent_entry) if parent_entry unless parent_entry.is_a?(::KirguduBase::DynamicPages::Element) raise "Parent Entry must be a derivative of class ::KirguduBase::Pages::Element" end self.parent_entry = parent_entry end end |
#kontroller_klass ⇒ Object
40 41 42 |
# File 'app/models/kirgudu_base/dynamic_pages/element.rb', line 40 def kontroller_klass self.parent_entry.kontroller_klass if self.parent_entry && self.parent_entry.respond_to?(:kontroller_klass) end |
#to_external_hash(options = {}) ⇒ Object
35 36 37 38 |
# File 'app/models/kirgudu_base/dynamic_pages/element.rb', line 35 def to_external_hash( = {}) ||= {} end |