FeedValidator is a gem which validates the RSS feeds through SOAP protocol of the W3C Feed Validation service. It helps to find out errors in RSS or ATOM feeds. In Rails app we can do the feed validation by installing the gem.
-
Step#1
- Install the FeedValidator as a gem:
gem feedvalidator
Run the bundler to install the gem
Step#2
Step#3
class CreateFeeds < ActiveRecord::Migration def self.up create_table :feeds do |t| t.string :title t.timestamps end end def self.down drop_table :feeds end end
Step#4
def create site_url = params[:feed][:title].sub(/(\/)+$/,'') begin v = W3C::FeedValidator.new if v.validate_url(site_url) && v.valid? @feed = Feed.new(:title => site_url) @feed.save end rescue # Do nothing end redirect_to request.referrer end