diff --git a/app/models/feed.rb b/app/models/feed.rb index 61c5fb9..bffd257 100644 --- a/app/models/feed.rb +++ b/app/models/feed.rb @@ -4,6 +4,10 @@ class Feed < ActiveRecord::Base after_create :fetch def fetch + Delayed::Job.enqueue self + end + + def perform feed = FeedTools::Feed.open(url) transaction do diff --git a/app/views/feeds/index.html.erb b/app/views/feeds/index.html.erb index 8a2c9c3..da325fa 100644 --- a/app/views/feeds/index.html.erb +++ b/app/views/feeds/index.html.erb @@ -1,4 +1,4 @@ -

Feed Reader - no queueing

+

Queueing Feed Reader

diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8688aee..2a22347 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -3,7 +3,7 @@ - Feed Reader - no queueing + Queueing Feed Reader <%= stylesheet_link_tag 'main' %>