docbrown/app/controllers/buffered_articles_controller.rb
2018-02-28 16:11:08 -05:00

18 lines
429 B
Ruby

class BufferedArticlesController < ApplicationController
def index
@article_urls = buffered_article_urls
render json: {
urls: @article_urls,
}.to_json
end
def buffered_article_urls
if Rails.env.production?
Article.
where("last_buffered > ?", 24.hours.ago).
map { |a| "https://dev.to#{a.path}" }
else
Article.all.map { |a| "https://dev.to#{a.path}" }
end
end
end