Module: RESTFramework::BaseModelControllerMixin::ClassMethods

Extended by:
ClassMethodHelpers
Includes:
RESTFramework::BaseControllerMixin::ClassMethods
Defined in:
lib/rest_framework/controllers/models.rb

Overview

By default (and for now), we will just use ‘as_json`, but we should consider supporting:

active_model_serializers (problem:
  https://github.com/rails-api/active_model_serializers#whats-happening-to-ams)
fast_jsonapi (really good and fast serializers)

Instance Method Summary collapse

Methods included from ClassMethodHelpers

_restframework_attr_reader

Methods included from RESTFramework::BaseControllerMixin::ClassMethods

#skip_actions

Instance Method Details

#extra_actions(skip_undefined: true) ⇒ Object

For model-based mixins, ‘@extra_collection_actions` is synonymous with `@extra_actions`.

Parameters:

  • skip_undefined (Boolean) (defaults to: true)

    whether we should skip routing undefined actions



35
36
37
38
39
40
41
42
# File 'lib/rest_framework/controllers/models.rb', line 35

def extra_actions(skip_undefined: true)
  actions = (
    _restframework_try_class_level_variable_get(:extra_collection_actions) ||
    _restframework_try_class_level_variable_get(:extra_actions, default: {})
  )
  actions = actions.select { |a| self.method_defined?(a) } if skip_undefined
  return actions
end