Q:

How to make news downloaded every 30 minutes? 

I have two models Company and News
How to make news downloaded every 30 minutes? 
I've tried through gem 'whenever', nothing happens
class Company < ActiveRecord::Base
  after_save :load_news 

  def load_news
    last_entry = self.news.last
    if last_entry.nil? 
      feed = Feedzirra::Feed.fetch_and_parse(self.url)
    else
      feed = Feedzirra::Feed.fetch_and_parse(self.url,
        :if_modified_since => last_entry.published_at.to_time)
    end

    Company.add_entries(feed.entries, self.id)
  end

  def self.update_all_feeds(urls)
    Feedzirra::Feed.fetch_and_parse(urls,
      :on_success => lambda { |url, feed|
        rss = Comapny.select("companies.id").where(:url => url).first
        Company.add_entries(feed.entries, rss.id)
      }
    )
  end

end

class News < ActiveRecord::Base
  attr_accessible :content, :guid, :name, :published_at, :summary, :url, :company_id
end

A:

whenever scpript
every 15.minutes do
  rake "collect"
end

and rake file
task :collect => :environment do
  urls = Company.select("companies.url").all.map { |v| v[:url] }
  Company.update_all_feeds(urls)
end

