Class: Tenon::ApplicationSerializer
- Inherits:
-
ActiveModel::Serializer
- Object
- ActiveModel::Serializer
- Tenon::ApplicationSerializer
show all
- Defined in:
- app/serializers/tenon/application_serializer.rb
Overview
Some basic functionality that most resources will want
Instance Method Summary
collapse
Instance Method Details
#attributes ⇒ Object
19
20
21
|
# File 'app/serializers/tenon/application_serializer.rb', line 19
def attributes
super.merge(default_attributes)
end
|
4
5
6
7
8
|
# File 'app/serializers/tenon/application_serializer.rb', line 4
def formatted_publish_at
if object.publish_at.present?
object.publish_at.strftime('%B %e, %Y at %-l:%m%p')
end
end
|
#resource_type ⇒ Object
14
15
16
17
|
# File 'app/serializers/tenon/application_serializer.rb', line 14
def resource_type
klass = object.object ? object.object.class : object.class
klass.to_s.underscore
end
|
#to_param ⇒ Object
10
11
12
|
# File 'app/serializers/tenon/application_serializer.rb', line 10
def to_param
object.to_param
end
|