Module: GtfsEngine::DefaultViewsHelper

Defined in:
app/helpers/gtfs_engine/default_views_helper.rb

Instance Method Summary collapse

Instance Method Details

#index(json, records) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/helpers/gtfs_engine/default_views_helper.rb', line 17

def index(json, records)
  json.cache! [controller_name, filter] do
    json.ignore_nil! true

    json.status 'success'
    json.data do
      json.set! controller_name do
        json.array!(records) {|record| json.extract! record, *fields }
      end
    end
  end
end

#show(json, record) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'app/helpers/gtfs_engine/default_views_helper.rb', line 30

def show(json, record)
  json.cache! record do
    json.ignore_nil! true
    json.status 'success'
    json.data do
      json.set! controller_name.singularize do
        json.extract! record, *fields
      end
    end
  end
end