The code powering m.abunchtell.com https://m.abunchtell.com
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

26 рядки
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