Sha256: 83cc0fee4d7a7e0590b86cb5680e2f08818c877a0963bb99d8fb3352769ce0ae

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 KB

Contents

def sample_params
  ActiveSupport::HashWithIndifferentAccess.new(
    {
      "draw"=>"1",
      "columns"=> {
        "0"=> {
          "data"=>"username", "name"=>"", "searchable"=>"true", "orderable"=>"true",
          "search"=> {
            "value"=>"", "regex"=>"false"
          }
        },
        "1"=> {
          "data"=>"email", "name"=>"", "searchable"=>"true", "orderable"=>"true",
          "search"=> {
            "value"=>"", "regex"=>"false"
          }
        },
        "2"=> {
          "data"=>"first_name", "name"=>"", "searchable"=>"false", "orderable"=>"false",
          "search"=> {
            "value"=>"", "regex"=>"false"
          }
        },
        "3"=> {
          "data"=>"last_name", "name"=>"", "searchable"=>"false", "orderable"=>"true",
          "search"=> {
            "value"=>"", "regex"=>"false"
          }
        },
      },
      "order"=> {
        "0"=> {"column"=>"0", "dir"=>"asc"}
      },
      "start"=>"0", "length"=>"10", "search"=>{
        "value"=>"", "regex"=>"false"
      },
      "_"=>"1423364387185"
    }
  )
end

class SampleDatatable < AjaxDatatablesRails::Base
  def view_columns
    @view_columns ||= ['User.username', 'User.email', 'User.first_name', 'User.last_name']
  end

  def data
    [{}, {}]
  end

  def get_raw_records
    User.all
  end
end


class ComplexDatatable < SampleDatatable
  def view_columns
    @view_columns ||= {
      username: { source: 'User.username' },
      email: { source: 'User.email' },
      first_name: { source: 'User.first_name' },
      last_name: { source: 'User.last_name' }
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datatables-net-0.4.0 spec/test_helpers.rb