Class: Locomotive::ContentEntryService
- Inherits:
-
Struct
- Object
- Struct
- Locomotive::ContentEntryService
- Defined in:
- app/services/locomotive/content_entry_service.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
Instance Method Summary collapse
-
#all(options = {}) ⇒ Object
List all the entries of a content type.
-
#destroy_all ⇒ Object
Destroy all the entries of a content type.
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type
2 3 4 |
# File 'app/services/locomotive/content_entry_service.rb', line 2 def content_type @content_type end |
Instance Method Details
#all(options = {}) ⇒ Object
List all the entries of a content type.
If the content type allows the pagination, in other words, if the entries are not ordered by the position column), then this method will return a paginated list of entries.
This list can also be filtered by the _label attribute, by setting the “q” key in the options.
For a more powerful search, you can use the “where” key which accepts a JSON string or a Hash.
18 19 20 21 22 23 24 25 26 |
# File 'app/services/locomotive/content_entry_service.rb', line 18 def all( = {}) = () if [:grouping] content_type.list_or_group_entries() else content_type.ordered_entries() end end |
#destroy_all ⇒ Object
Destroy all the entries of a content type. Runs each entry’s destroy callbacks.
31 32 33 |
# File 'app/services/locomotive/content_entry_service.rb', line 31 def destroy_all content_type.entries.destroy_all end |