Class: Telm::ResourcesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/telm/resources_controller.rb

Constant Summary collapse

VISIBLE_COLUMNS =

A visible slice this size keeps very wide tables scannable; the rest are counted in the "+N more" hint until the record page (M5).

12

Instance Method Summary collapse

Instance Method Details

#indexObject



11
12
13
14
15
# File 'app/controllers/telm/resources_controller.rb', line 11

def index
  @result = Core::Query.new(@resource, query_options).result
  @visible_columns = @resource.columns.first(VISIBLE_COLUMNS)
  @hidden_column_count = @resource.columns.size - @visible_columns.size
end

#showObject



17
18
19
20
# File 'app/controllers/telm/resources_controller.rb', line 17

def show
  @record = @resource.model.find_by(@resource.primary_key => params[:id])
  render "telm/errors/record_not_found", status: :not_found unless @record
end