summaryrefslogtreecommitdiff
path: root/app/controllers/rss_controller.rb
blob: c2149d9025507f184e1cff180e26e665b6d28ad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class RssController < ApplicationController
  
  before_action :get_host

  def updates
    expires_in 31.minutes, :public => true
    I18n.locale = I18n.default_locale

    @items = feed_items("update")

    respond_to do |format|
      format.xml {}
      format.rdf {}
    end
  end

  def tag_updates
    expires_in 31.minutes, :public => true
    I18n.locale = I18n.default_locale

    @tag   = params[:tag]
    @items = feed_items(@tag)

    respond_to do |format|
      format.xml {}
    end
  end

  protected

    def feed_items tag
      Page.aggregate(:tags => tag.to_s.downcase,
                     :limit => 20,
                     :order_by => "published_at",
                     :order_direction => "DESC")
    end

    def get_host
      @host = request.protocol + request.host_with_port
    end
  
end