Class: RESTFramework::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/rest_framework.rb

Overview

Global configuration should be kept minimal, as controller-level configurations allows multiple APIs to be defined to behave differently.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



47
48
49
# File 'lib/rest_framework.rb', line 47

def initialize
  self.show_backtrace = Rails.env.development?
end

Instance Attribute Details

#disable_auto_finalizeObject

Do not run `rrf_finalize` on controllers automatically using a `TracePoint` hook. This is a performance option and must be global because we have to determine this before any controller-specific configuration is set. If this is set to `true`, then you must manually call `rrf_finalize` after any configuration on each controller that needs to participate in:

- Model delegation, for the helper methods to be defined dynamically.
- Websockets, for `::Channel` class to be defined dynamically.
- Controller configuration freezing.


32
33
34
# File 'lib/rest_framework.rb', line 32

def disable_auto_finalize
  @disable_auto_finalize
end

#disable_rescue_fromObject

Option to disable `rescue_from` on the controller mixins.



45
46
47
# File 'lib/rest_framework.rb', line 45

def disable_rescue_from
  @disable_rescue_from
end

#freeze_configObject

Freeze configuration attributes during finalization to prevent accidental mutation.



35
36
37
# File 'lib/rest_framework.rb', line 35

def freeze_config
  @freeze_config
end

#large_reverse_association_tablesObject

Specify reverse association tables that are typically very large, andd therefore should not be added to fields by default.



39
40
41
# File 'lib/rest_framework.rb', line 39

def large_reverse_association_tables
  @large_reverse_association_tables
end

#show_backtraceObject

Whether the backtrace should be shown in rescued errors.



42
43
44
# File 'lib/rest_framework.rb', line 42

def show_backtrace
  @show_backtrace
end