Module: RESTFramework::Mixins::BaseControllerMixin::ClassMethods

Defined in:
lib/rest_framework/mixins/base_controller_mixin.rb

Instance Method Summary collapse

Instance Method Details

#get_titleObject

By default, this is the name of the controller class, titleized and with any custom inflection acronyms applied.



46
47
48
49
50
51
# File 'lib/rest_framework/mixins/base_controller_mixin.rb', line 46

def get_title
  return self.title || RESTFramework::Utils.inflect(
    self.name.demodulize.chomp("Controller").titleize(keep_id_suffix: true),
    self.inflect_acronyms,
  )
end

#label_for(s) ⇒ Object

Get a label from a field/column name, titleized and inflected.



54
55
56
57
58
59
# File 'lib/rest_framework/mixins/base_controller_mixin.rb', line 54

def label_for(s)
  return RESTFramework::Utils.inflect(
    s.to_s.titleize(keep_id_suffix: true),
    self.inflect_acronyms,
  )
end

#rrf_finalizeObject

Define any behavior to execute at the end of controller definition. :nocov:



63
64
65
66
67
68
69
70
# File 'lib/rest_framework/mixins/base_controller_mixin.rb', line 63

def rrf_finalize
  if RESTFramework.config.freeze_config
    self::RRF_BASE_CONFIG.keys.each { |k|
      v = self.send(k)
      v.freeze if v.is_a?(Hash) || v.is_a?(Array)
    }
  end
end