This is because you store data into a single @tweet
record, you need also create a new record just after the @tweet.save
, it is need in order to new data do not overwrite old ones. Do something like:
@content.each do |post|
if post.id > element.tweet_since_id
@tweet = Tweet.new :screen_name => element.screen_name, :content => post.text
@tweet.user_id = element.id
@tweet.save
element.tweet_since_id = post.id
end
end
Note, that it is good style that fields of a record of a view something_id
has belong to another record types in your DB, if you have no record assiciated with the field, use another naming, like something_xid
or somethind_sid
.