Method: ApplicationHelper#promoted_posts

Defined in:
app/helpers/application_helper.rb

Get a list of network promoted posts, ignoring expired entries.

Returns:

  • (Hash{Integer => Integer})

    A hash of post IDs as keys, and Unix entry timestamp as values.



270
271
272
273
# File 'app/helpers/application_helper.rb', line 270

def promoted_posts
  JSON.parse(RequestContext.redis.get('network/promoted_posts') || '{}')
      .select { |_k, v| DateTime.now.to_i - v <= 3600 * 24 * 28 }
end