嗨,我有两个模型公司和饲料
公司.rb
class Company < ActiveRecord::Base
attr_accessible :rss_url, :name
has_many :feeds
end
饲料.rb
class Feed < ActiveRecord::Base
attr_accessible :guid, :name, :published_at, :summary, :url
after_create { |feed| FeedEntry.update_from_feed(feed.feed_url) }
belongs_to :company
def self.update_from_feed(rss_url) ?????
feed = Feedzirra::Feed.fetch_and_parse(rss_url) ?????
add_entries(feed.entries)
end
end
两个如何从公司获取 RSS_URL 到 feed ?