class FeedController < ApplicationController
- skip_before_filter :verify_authenticity_token
-
def index
- # @feeds = FeedItem.find(:all, :select => 'DISTINCT feed_name')
@feeds = FeedItem.select(:feed_name).distinct
respond_to do |format|
format.html
format.rss { render :layout => false }
end
end
-
def show
if FeedItem::valid_feed_name?(params[:feed_name])
@feed_name = params[:feed_name]
@feed_items = FeedItem.in_feed(@feed_name)
respond_to do |format|
- if @feed_items == []
+ if @feed_items.empty?
flash[:notice] = "No items in feed #{@feed_name}"
format.html { redirect_to index_path }
format.rss { render :layout => false }
end
end
-
def update
if FeedItem::valid_feed_name?(params[:feed_name])
item = FeedItem.in_feed(params[:feed_name]).entitled(params[:title]).take
# private
-
private def create_item
item = FeedItem.new(:feed_name => params[:feed_name],
:title => params[:title],
end
end
-
private def update_item(item)
if item.update_attribute(:description, params[:description])
flash[:notice] = "Element #{params[:title]} updated"
end
end
-
private def destroy_item(item)
if item.destroy
flash[:notice] = "Element #{params[:title]} deleted"