Procházet zdrojové kódy

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

This reverts commit e2eb60a6a7.
master
Adrian Short před 12 roky
rodič
revize
95b8f0e145
2 změnil soubory, kde provedl 2 přidání a 11 odebrání
  1. +1
    -5
      app/controllers/feeds_controller.rb
  2. +1
    -6
      app/models/feed.rb

+ 1
- 5
app/controllers/feeds_controller.rb Zobrazit soubor

@@ -41,11 +41,7 @@ class FeedsController < ApplicationController
# POST /feeds
# POST /feeds.json
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|
if @feed.save


+ 1
- 6
app/models/feed.rb Zobrazit soubor

@@ -15,7 +15,7 @@ class Feed
validates :title, :presence => true
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

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

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(
:title => feed.title,


Načítá se…
Zrušit
Uložit