Module: Effective::EffectiveDatatable::Collection
- Included in:
- Datatable
- Defined in:
- app/models/effective/effective_datatable/collection.rb
Instance Method Summary collapse
-
#active_record_array_collection? ⇒ Boolean
[User<1>, User<2>, Post<1>, Page<3>].
-
#active_record_collection? ⇒ Boolean
User.all.
- #active_record_polymorphic_array_collection? ⇒ Boolean
-
#array_collection? ⇒ Boolean
[[1, ‘foo’], [2, ‘bar’]].
-
#collection_class ⇒ Object
Used for authorization.
Instance Method Details
#active_record_array_collection? ⇒ Boolean
- User<1>, User<2>, Post<1>, Page<3>
16 17 18 |
# File 'app/models/effective/effective_datatable/collection.rb', line 16 def active_record_array_collection? @active_record_array_collection == true end |
#active_record_collection? ⇒ Boolean
User.all
11 12 13 |
# File 'app/models/effective/effective_datatable/collection.rb', line 11 def active_record_collection? @active_record_collection == true end |
#active_record_polymorphic_array_collection? ⇒ Boolean
20 21 22 23 24 |
# File 'app/models/effective/effective_datatable/collection.rb', line 20 def active_record_polymorphic_array_collection? return false unless active_record_array_collection? return @active_record_polymorphic_array_collection unless @active_record_polymorphic_array_collection.nil? @active_record_polymorphic_array_collection = collection.map { |obj| obj.class }.uniq.length > 1 end |
#array_collection? ⇒ Boolean
- [1, ‘foo’], [2, ‘bar’]
27 28 29 |
# File 'app/models/effective/effective_datatable/collection.rb', line 27 def array_collection? @array_collection == true end |
#collection_class ⇒ Object
Used for authorization. We authorize with authorized?(:index, collection_class)
6 7 8 |
# File 'app/models/effective/effective_datatable/collection.rb', line 6 def collection_class @collection_class # Will be either User/Post/etc or Array end |