Sha256: 2172198f74e25aee9236e3ee0fd769a2a3670b1598fd7b1534273c70e1a112ad

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

Contents

class <%= datatable_name %> < AjaxDatatablesRails::Base

  def view_columns
    # Declare strings in this format: ModelName.column_name
    # or in aliased_join_table.column_name format
    @view_columns ||= {
      # id: { source: "User.id", cond: :eq },
      # name: { source: "User.name", cond: :like }
    }
  end

  def data
    records.map do |record|
      {
        # example:
        # id: record.id,
        # name: record.name
      }
    end
  end

  private

  def get_raw_records
    # insert query here
  end

  # ==== These methods represent the basic operations to perform on records
  # and feel free to override them

  # def filter_records(records)
  # end

  # def sort_records(records)
  # end

  # def paginate_records(records)
  # end

  # ==== Insert 'presenter'-like methods below if necessary
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ajax-datatables-rails-0.4.0 lib/generators/rails/templates/datatable.rb
datatables-net-0.4.0 lib/generators/rails/templates/datatable.rb