Default_profile_6_normalnanotechno

http://twitter.com/nanotechno

Re: People you're following on Twitter using twitter-auth

# using the Twitter base app mentioned here: http://blog.railsrumble.com/2009/7/23/this-bird-s-ready-to-rumble

class User < TwitterAuth::GenericUser

  def twitter_following_ids # ids of users followed on twitter
    twitter.get("/friends/ids")
    rescue
      nil
    end
  end

end

# Using /friends/ids API, no pagination necessary and just one call returns all friends' ids
Reveal More
Added over 2 years ago

Re: Re: Re: Random Records in Rails

# This code isn't database agnostic. 
 
  def self.random
    find(:first, :order => "RAND()")
  end
 
# SQLite3::SQLException: no such function: RAND: SELECT * FROM "widgets"  ORDER BY RAND() LIMIT 1

# Flowcoder needs a comment system! <3
# I only work with mysql databases you could change it to RANDOM() for sqlite, but that won't help much since you probably have # a mysql / postsql production database. I'll edit my post to mention that.
Reveal More
Added over 2 years ago
Post Code