Browse Source

Revert "Better error handling when feeds don't parse"

This reverts commit e2eb60a6a7.
master
Adrian Short 12 years ago
parent
commit
95b8f0e145
2 changed files with 2 additions and 11 deletions
  1. +1
    -5
      app/controllers/feeds_controller.rb
  2. +1
    -6
      app/models/feed.rb

+ 1
- 5
app/controllers/feeds_controller.rb View File

@@ -41,11 +41,7 @@ class FeedsController < ApplicationController
# POST /feeds # POST /feeds
# POST /feeds.json # POST /feeds.json
def create def create
begin
@feed = Feed.new(params[:feed])
rescue
redirect_to '/', error: "Feed didn't parse. Please check it with the validator."
end
@feed = Feed.new(params[:feed])


respond_to do |format| respond_to do |format|
if @feed.save if @feed.save


+ 1
- 6
app/models/feed.rb View File

@@ -15,7 +15,7 @@ class Feed
validates :title, :presence => true validates :title, :presence => true
validates_format_of :feed_url, :with => URI::regexp(%w(http https)), :message => "must be a valid URL" validates_format_of :feed_url, :with => URI::regexp(%w(http https)), :message => "must be a valid URL"
before_create :get
after_create :get
# Fetch and parse feed contents from web # Fetch and parse feed contents from web


@@ -31,11 +31,6 @@ class Feed
Feedzirra::Feed.add_common_feed_element('generator', :as => :generator) Feedzirra::Feed.add_common_feed_element('generator', :as => :generator)


feed = Feedzirra::Feed.fetch_and_parse(@feed_url) feed = Feedzirra::Feed.fetch_and_parse(@feed_url)
# We fetched the feed OK but couldn't parse it. HTTP 200 OK
if feed.is_a? Fixnum
raise
end


self.set( self.set(
:title => feed.title, :title => feed.title,


Loading…
Cancel
Save