Module: DatatableUtils
- Defined in:
- lib/datatable_utils.rb,
lib/datatable_utils/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'lib/datatable_utils.rb', line 4 def self.included(base) base.class_eval do delegate :params, :h, :l, :link_to, to: :@view end end |
Instance Method Details
#as_json(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/datatable_utils.rb', line 16 def as_json( = {}) { sEcho: params[:sEcho].to_i, iTotalRecords: records_count, iTotalDisplayRecords: (paginate? ? cached_collection.total_entries : records_count), aaData: data } end |
#initialize(view, collection, controller = nil) ⇒ Object
10 11 12 13 14 |
# File 'lib/datatable_utils.rb', line 10 def initialize(view, collection, controller = nil) @view = view @collection = collection @controller = controller end |