Method: Effective::Resources::I18n#human_action_name

Defined in:
app/models/effective/resources/i18n.rb

#human_action_name(action) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/effective/resources/i18n.rb', line 6

def human_action_name(action)
  if klass.respond_to?(:model_name)
    key = "activerecord.actions.#{klass.model_name.i18n_key}.#{action}"

    value = ::I18n.t(key)
    return value unless value.include?(key) # missing translation
  end

  if crud_actions.include?(action)
    # Raises exception if not present
    return EffectiveResources.et("effective_resources.actions.#{action}")
  end

  action.to_s.titleize
end