Remove tweets

This commit is contained in:
Ari Timonen 2015-07-02 02:34:39 +03:00
parent 94ba3414eb
commit fecd0742aa
6 changed files with 1 additions and 106 deletions

View file

@ -1,29 +0,0 @@
require 'rss/2.0'
require 'open-uri'
class TweetsController < ApplicationController
def index
@tweets = Tweet.all order: "created_at DESC"
@nobody = true
end
def show
@tweet = Tweet.find(params[:id])
end
def refresh
open('http://twitter.com/statuses/user_timeline/16676427.rss') do |http|
RSS::Parser.parse(http.read, false).items.each do |item|
unless Tweet.first :conditions => {:link => item.link}
tweet = Tweet.new
tweet.link = item.link
tweet.msg = item.title.gsub(/NS2: /, "")
tweet.created_at = DateTime.parse item.pubDate.to_s
tweet.save
end
end
end
render text: t(:tweets_refresh)
end
end