Sha256: 669e70825c7f5d468fd613fa4dc92f5e2d4cb175dbd5ceeb65aae7a9e8f47d4a
Contents?: true
Size: 966 Bytes
Versions: 5
Compression:
Stored size: 966 Bytes
Contents
class SchoolDatatable < AjaxDatatablesRails::Base def_delegators :@view, :link_to, :manage_school_path, :manage_bus_list_path def view_columns @view_columns ||= { id: { source: 'School.id', cond: :eq }, name: { source: 'School.name' }, city: { source: 'School.city' }, state: { source: 'School.state' }, questionnaire_count: { source: 'School.questionnaire_count', searchable: false } } end private def data records.map do |record| { id: record.id, name: link_to(record.name, manage_school_path(record)), city: record.city, state: record.state, questionnaire_count: record.questionnaire_count, bus_list: record.bus_list ? link_to(record.bus_list.name, manage_bus_list_path(record.bus_list)) : '' } end end # rubocop:disable Naming/AccessorMethodName def get_raw_records School.all end # rubocop:enable Naming/AccessorMethodName end
Version data entries
5 entries across 5 versions & 1 rubygems