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>
18 19 20 |
# File 'app/models/effective/effective_datatable/collection.rb', line 18 def active_record_array_collection? @active_record_array_collection == true end |
#active_record_collection? ⇒ Boolean
User.all
13 14 15 |
# File 'app/models/effective/effective_datatable/collection.rb', line 13 def active_record_collection? @active_record_collection == true end |
#active_record_polymorphic_array_collection? ⇒ Boolean
22 23 24 25 26 |
# File 'app/models/effective/effective_datatable/collection.rb', line 22 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’]
29 30 31 |
# File 'app/models/effective/effective_datatable/collection.rb', line 29 def array_collection? @array_collection == true end |
#collection_class ⇒ Object
Used for authorization. We authorize with authorized?(:index, collection_class)
8 9 10 |
# File 'app/models/effective/effective_datatable/collection.rb', line 8 def collection_class @collection_class # Will be either User/Post/etc or Array end |