Sha256: ef13071255644bdf1b7544b5a704b0f040edf6e583db56d9ecd80e8605ee0d52

Contents?: true

Size: 534 Bytes

Versions: 3

Compression:

Stored size: 534 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

  def get_raw_records
    # insert query here
    # User.all
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ajax-datatables-rails-0.4.3 lib/generators/rails/templates/datatable.rb
ajax-datatables-rails-0.4.2 lib/generators/rails/templates/datatable.rb
ajax-datatables-rails-0.4.1 lib/generators/rails/templates/datatable.rb