Class: ArchetypeSerializer

Inherits:
ApplicationSerializer show all
Defined in:
app/serializers/archetype_serializer.rb

Instance Method Summary collapse

Methods inherited from ApplicationSerializer

expire_cache_fragment!, fragment_cache

Methods inherited from ActiveModel::Serializer

#include!

Instance Method Details

#nameObject



17
18
19
# File 'app/serializers/archetype_serializer.rb', line 17

def name
  I18n.t("archetypes.#{object.id}.title")
end

#optionsObject



6
7
8
9
10
11
12
13
14
15
# File 'app/serializers/archetype_serializer.rb', line 6

def options
  object.options.keys.collect do |k|
    {
      key: k,
      title: I18n.t("archetypes.#{object.id}.options.#{k}.title"),
      description: I18n.t("archetypes.#{object.id}.options.#{k}.description"),
      option_type: object.options[k],
    }
  end
end