Class: Biovision::Helpers::DataHelper
- Inherits:
-
Object
- Object
- Biovision::Helpers::DataHelper
- Defined in:
- app/lib/biovision/helpers/data_helper.rb
Overview
Helper for receiving model data in controllers
Instance Attribute Summary collapse
-
#model_class ⇒ Object
readonly
Returns the value of attribute model_class.
Instance Method Summary collapse
- #administrative_collection(page = 1) ⇒ Object
-
#initialize(model_class, filters = {}) ⇒ DataHelper
constructor
A new instance of DataHelper.
- #personal_collection(user, page = 1) ⇒ Object
Constructor Details
#initialize(model_class, filters = {}) ⇒ DataHelper
11 12 13 14 |
# File 'app/lib/biovision/helpers/data_helper.rb', line 11 def initialize(model_class, filters = {}) @model_class = model_class @filters = filters end |
Instance Attribute Details
#model_class ⇒ Object (readonly)
Returns the value of attribute model_class.
7 8 9 |
# File 'app/lib/biovision/helpers/data_helper.rb', line 7 def model_class @model_class end |
Instance Method Details
#administrative_collection(page = 1) ⇒ Object
17 18 19 20 |
# File 'app/lib/biovision/helpers/data_helper.rb', line 17 def administrative_collection(page = 1) paginates = model_class.respond_to?(:page_for_administration) paginates ? administrative_page(page) : administrative_list end |
#personal_collection(user, page = 1) ⇒ Object
24 25 26 27 |
# File 'app/lib/biovision/helpers/data_helper.rb', line 24 def personal_collection(user, page = 1) paginates = model_class.respond_to?(:page_for_owner) paginates ? personal_page(user, page) : personal_list(user) end |