Class: ForestRails::ApimapsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/forest_rails/apimaps_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_user_from_jwt

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/forest_rails/apimaps_controller.rb', line 3

def index
  result = []

  ActiveRecord::Base.connection.tables.map do |model_name|
    begin
      model = model_name.classify.constantize
      result << SchemaAdapter.new(model).perform
    rescue => error
      puts error.inspect
    end
  end

  render json: result, each_serializer: ApimapSerializer,
    adapter: :json_api
end