mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-05-31 00:41:20 +00:00
Remove tweets
This commit is contained in:
parent
94ba3414eb
commit
fecd0742aa
6 changed files with 1 additions and 106 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue