• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gregschmit / rails-rest-framework / 324

pending completion
324

push

travis-ci-com

gregschmit
Add option to allow all nested attributes by default.

11 of 11 new or added lines in 1 file covered. (100.0%)

805 of 887 relevant lines covered (90.76%)

74.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.88
/lib/rest_framework.rb
1
module RESTFramework
1✔
2
  BUILTIN_ACTIONS = {
1✔
3
    index: :get,
4
    new: :get,
5
    create: :post,
6
  }.freeze
7
  BUILTIN_MEMBER_ACTIONS = {
8
    show: :get,
1✔
9
    edit: :get,
10
    update: [:put, :patch].freeze,
11
    destroy: :delete,
12
  }.freeze
13
  RRF_BUILTIN_ACTIONS = {
1✔
14
    options: :options,
15
  }.freeze
16
  RRF_BUILTIN_BULK_ACTIONS = {
17
    update_all: [:put, :patch].freeze,
1✔
18
    destroy_all: :delete,
19
  }.freeze
20

21
  # Global configuration should be kept minimal, as controller-level configurations allows multiple
22
  # APIs to be defined to behave differently.
23
  class Config
1✔
24
    DEFAULT_EXCLUDE_ASSOCIATION_CLASSES = %w(
25
      ActionText::RichText
1✔
26
      ActiveStorage::Attachment
27
      ActiveStorage::Blob
28
    ).freeze
29

30
    # Do not run `rrf_finalize` on controllers automatically using a `TracePoint` hook. This is a
31
    # performance option and must be global because we have to determine this before any
32
    # controller-specific configuration is set. If this is set to `true`, then you must manually
33
    # call `rrf_finalize` after any configuration on each controller that needs to participate
34
    # in:
35
    #  - Model delegation, for the helper methods to be defined dynamically.
36
    #  - Websockets, for `::Channel` class to be defined dynamically.
37
    #  - Controller configuration freezing.
38
    attr_accessor :disable_auto_finalize
1✔
39

40
    # Freeze configuration attributes during finalization to prevent accidental mutation.
41
    attr_accessor :freeze_config
1✔
42

43
    # Specify reverse association tables that are typically very large, andd therefore should not be
44
    # added to fields by default.
45
    attr_accessor :large_reverse_association_tables
1✔
46

47
    # Whether the backtrace should be shown in rescued errors.
48
    attr_accessor :show_backtrace
1✔
49

50
    # Option to disable `rescue_from` on the controller mixins.
51
    attr_accessor :disable_rescue_from
1✔
52

53
    # Options to exclude certain classes from being added by default as association fields.
54
    attr_accessor :exclude_association_classes
1✔
55

56
    def initialize
1✔
57
      self.show_backtrace = Rails.env.development?
1✔
58
      self.exclude_association_classes = DEFAULT_EXCLUDE_ASSOCIATION_CLASSES
1✔
59
    end
60
  end
61

62
  def self.config
1✔
63
    return @config ||= Config.new
1,809✔
64
  end
65

66
  def self.configure
1✔
67
    yield(self.config)
×
68
  end
69

70
  def self.features
1✔
71
    return @features ||= {
70✔
72
      html_forms: false,
73
    }
74
  end
75
end
76

77
require_relative "rest_framework/controller_mixins"
1✔
78
require_relative "rest_framework/engine"
1✔
79
require_relative "rest_framework/errors"
1✔
80
require_relative "rest_framework/filters"
1✔
81
require_relative "rest_framework/generators"
1✔
82
require_relative "rest_framework/paginators"
1✔
83
require_relative "rest_framework/routers"
1✔
84
require_relative "rest_framework/serializers"
1✔
85
require_relative "rest_framework/utils"
1✔
86
require_relative "rest_framework/version"
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc