Module: ActionSet::InstanceMethods
- Defined in:
- lib/action_set.rb
Instance Method Summary collapse
- #export_set(set) ⇒ Object
- #filter_set(set) ⇒ Object
-
#paginate_set(set) ⇒ Object
TODO: should we move the default value setting to this layer, and have ActiveSet require instructions for pagination?.
- #process_set(set) ⇒ Object
- #sort_set(set) ⇒ Object
Instance Method Details
#export_set(set) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/action_set.rb', line 45 def export_set(set) return send_file(set, (request.format)) if set.is_a?(String) && File.file?(set) active_set = ensure_active_set(set) exported_data = active_set.export(export_instructions) send_data(exported_data, (request.format)) end |
#filter_set(set) ⇒ Object
25 26 27 28 29 |
# File 'lib/action_set.rb', line 25 def filter_set(set) active_set = ensure_active_set(set) active_set = active_set.filter(filter_instructions_for(set)) if filter_params.any? active_set end |
#paginate_set(set) ⇒ Object
TODO: should we move the default value setting to this layer, and have ActiveSet require instructions for pagination?
39 40 41 42 43 |
# File 'lib/action_set.rb', line 39 def paginate_set(set) active_set = ensure_active_set(set) active_set = active_set.paginate(paginate_instructions) active_set end |
#process_set(set) ⇒ Object
21 22 23 |
# File 'lib/action_set.rb', line 21 def process_set(set) paginate_set(sort_set(filter_set(ensure_active_set(set)))) end |
#sort_set(set) ⇒ Object
31 32 33 34 35 |
# File 'lib/action_set.rb', line 31 def sort_set(set) active_set = ensure_active_set(set) active_set = active_set.sort(sort_instructions) if sort_params.any? active_set end |