diff options
Diffstat (limited to 'app/controllers/rss_controller.rb')
| -rw-r--r-- | app/controllers/rss_controller.rb | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/app/controllers/rss_controller.rb b/app/controllers/rss_controller.rb index acffc0e..4b47218 100644 --- a/app/controllers/rss_controller.rb +++ b/app/controllers/rss_controller.rb | |||
| @@ -1,19 +1,21 @@ | |||
| 1 | class RssController < ApplicationController | 1 | class RssController < ApplicationController |
| 2 | 2 | ||
| 3 | before_filter :authenticate, :only => :recent_changes | 3 | before_action :authenticate, :only => :recent_changes |
| 4 | before_filter :get_host | 4 | before_action :get_host |
| 5 | 5 | ||
| 6 | def updates | 6 | def updates |
| 7 | expires_in 31.minutes, :public => true | 7 | expires_in 31.minutes, :public => true |
| 8 | 8 | ||
| 9 | I18n.locale = :de | 9 | I18n.locale = :de |
| 10 | 10 | ||
| 11 | @items = Page.heads.find_tagged_with( | 11 | @items = Page.heads |
| 12 | "update", | 12 | .joins("JOIN taggings ON taggings.taggable_id = pages.id |
| 13 | :order => "published_at DESC", | 13 | AND taggings.taggable_type = 'Page' |
| 14 | :limit => 20 | 14 | AND taggings.context = 'tags'") |
| 15 | ) | 15 | .joins("JOIN tags ON tags.id = taggings.tag_id") |
| 16 | 16 | .where("LOWER(tags.name) = ?", "update") | |
| 17 | .order("published_at DESC").limit(20) | ||
| 18 | |||
| 17 | respond_to do |format| | 19 | respond_to do |format| |
| 18 | format.xml {} | 20 | format.xml {} |
| 19 | format.rdf {} | 21 | format.rdf {} |
| @@ -21,13 +23,9 @@ class RssController < ApplicationController | |||
| 21 | end | 23 | end |
| 22 | 24 | ||
| 23 | def recent_changes | 25 | def recent_changes |
| 24 | @items = Page.all( | 26 | @items = Page.where( |
| 25 | :limit => 20, | 27 | "updated_at < ? AND updated_at > ?", Time.now, Time.now - 14.days |
| 26 | :order => "updated_at desc", | 28 | ).limit(20).order("updated_at desc") |
| 27 | :conditions => [ | ||
| 28 | "updated_at < ? AND updated_at > ?", Time.now, Time.now-14.days | ||
| 29 | ] | ||
| 30 | ) | ||
| 31 | end | 29 | end |
| 32 | 30 | ||
| 33 | protected | 31 | protected |
