Sha256: b901c37aaa51f86a8f78116a2759de47ec1758317ce44219d3a9d5a1627ba797

Contents?: true

Size: 782 Bytes

Versions: 3

Compression:

Stored size: 782 Bytes

Contents

class RssController < ApplicationController
  layout nil
  caches_page :index

  def index
    @posts = Post.find_all(nil, 'updated_at DESC', @app_config['main']['num_posts'])
    @title = @app_config['main']['title']
    @subtitle = @app_config['main']['subtitle']
  end
  
  # +method_missing+ provides the convenient /atom/username URLs to 
  # access a user's feed.  If a non-existent user is passed, it will
  # just return an empty feed.
  def method_missing(method)
    user      = User.find_by_username(method.to_s)
    @title    = user.title
    @subtitle = user.subtitle
    @posts    = user.posts.find_all(nil, 'created_at desc', @app_config['main']['num_posts']) rescue []
    render_action 'index'    
    cache_page if ActionController::Base.perform_caching
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
EliteJournal-1.9.400 app/controllers/rss_controller.rb
EliteJournal-1.9.401 app/controllers/rss_controller.rb
EliteJournal-1.9.403 app/controllers/rss_controller.rb