The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
500 B

  1. # frozen_string_literal: true
  2. class REST::CustomEmojiSerializer < ActiveModel::Serializer
  3. include RoutingHelper
  4. attributes :shortcode, :url, :static_url, :visible_in_picker
  5. attribute :category, if: :category_loaded?
  6. def url
  7. full_asset_url(object.image.url)
  8. end
  9. def static_url
  10. full_asset_url(object.image.url(:static))
  11. end
  12. def category
  13. object.category.name
  14. end
  15. def category_loaded?
  16. object.association(:category).loaded? && object.category.present?
  17. end
  18. end