Class: Anoubis::Etc::Data
- Inherits:
-
Object
- Object
- Anoubis::Etc::Data
- Defined in:
- app/controllers/anoubis/etc/data.rb
Overview
Class stores data information for current controller
Instance Attribute Summary collapse
-
#actions ⇒ Array?
Current defined string array of table actions.
-
#count ⇒ Integer
(defaults to: 0) Specify the count of rows for defined data model.
-
#data ⇒ ActiveRecord?
Current loaded data from the defined model or nil if data not loaded.
-
#eager_load ⇒ Array
(defaults to: []) Specify the current eager loaded models.
-
#fields ⇒ Hash<Symbol, Field>?
Current defined hash of model represented fields or nil if fields aren’t defined.
- #filter ⇒ Object
-
#limit ⇒ Integer
(defaults to: 10) Specify the total number of returned rows.
-
#model ⇒ ActiveRecord
(defaults to: nil) Specify the current ActiveRecord for controller (if exists).
-
#offset ⇒ Integer
(defaults to: 0) Specify the default offset for rows were returned.
-
#parent ⇒ ActiveRecord
(defaults to: nil) Specify the parent ActiveRecord for controller (if exists).
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Data
constructor
Sets default basic system parameters.
- #to_h ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Data
Sets default basic system parameters
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/anoubis/etc/data.rb', line 49 def initialize( = {}) self.data = nil self.fields = nil self.actions = nil self.parent = nil self.model = nil self.count = 0 self.eager_load = [] self.limit = 10 self.offset = 0 self.filter = nil end |
Instance Attribute Details
#actions ⇒ Array?
18 |
# File 'app/controllers/anoubis/etc/data.rb', line 18 class_attribute :actions, default: nil |
#count ⇒ Integer
42 |
# File 'app/controllers/anoubis/etc/data.rb', line 42 class_attribute :count, default: 0 |
#data ⇒ ActiveRecord?
Data is placed in this attribute when loaded from the model by actions ‘index’, ‘edit’, ‘update’, ‘create’ etc.
Returns current loaded data from the defined model or nil if data not loaded.
9 |
# File 'app/controllers/anoubis/etc/data.rb', line 9 class_attribute :data |
#eager_load ⇒ Array
30 |
# File 'app/controllers/anoubis/etc/data.rb', line 30 class_attribute :eager_load, default: [] |
#fields ⇒ Hash<Symbol, Field>?
Field’s options are placed in this attribute for actions ‘index’, ‘edit’, ‘update’, ‘create’ etc.
Returns current defined hash of model represented fields or nil if fields aren’t defined.
14 |
# File 'app/controllers/anoubis/etc/data.rb', line 14 class_attribute :fields, default: nil |
#filter ⇒ Object
45 |
# File 'app/controllers/anoubis/etc/data.rb', line 45 class_attribute :filter, default: nil |
#limit ⇒ Integer
34 |
# File 'app/controllers/anoubis/etc/data.rb', line 34 class_attribute :limit, default: 10 |
#model ⇒ ActiveRecord
26 |
# File 'app/controllers/anoubis/etc/data.rb', line 26 class_attribute :model, default: nil |
#offset ⇒ Integer
38 |
# File 'app/controllers/anoubis/etc/data.rb', line 38 class_attribute :offset, default: 0 |
#parent ⇒ ActiveRecord
22 |
# File 'app/controllers/anoubis/etc/data.rb', line 22 class_attribute :parent, default: nil |
Instance Method Details
#to_h ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/controllers/anoubis/etc/data.rb', line 75 def to_h { fields: self.fields, model: self.model, eager_load: self.eager_load, count: self.count, limit: self.limit, offset: self.offset, actions: self.actions, parent: self.parent } end |