views:

27

answers:

1

I am trying to create a stream that includes Twitter data + my app's but I'm having trouble with this because Twitter's data isn't properly coming out as an array. This is my code:

answers = Answer.find(:all, :conditions => {:user_id => @user_id }, :limit => 20)
tweets = Twitter::Search.new(params[:username])

@feed = (answers + tweets).order_by(&:created_at)

Any suggestions would be greatly appreciated.

+1  A: 

It looks like you're using the Twitter Gem? In which case, the Search class is Enumerable and you can therefore call to_a on an instance of it. So...

tweets = Twitter::Search.new(params[:username]).to_a
@feed = (answers + tweets).order_by(&:created_at)
Govan
Thanks, and Cool that managed to pull off part of it. It converted to an array but I get an error with the next line of code. It's not letting me sort the two together. (changed order_by to sort_by)Error message: ArgumentError in HomeController#showcomparison of ActiveSupport::TimeWithZone with String failedAny ideas?