Skip to content

Instantly share code, notes, and snippets.

@ajturner
Created September 19, 2010 06:11
Show Gist options
  • Save ajturner/586464 to your computer and use it in GitHub Desktop.
Save ajturner/586464 to your computer and use it in GitHub Desktop.
# (T) - Twitter Updates
# id = Arel::Attributes::Integer.new nil, :id
# update = Arel::Attributes::String.new nil, :update
# tuples = [[1, "Hai I can haz cheezburgerz"], [2, "Nom!"], [0, "What can you haz?"]]
# headers = [Arel::Attributes::Integer.new(nil, :id), Arel::Attributes::String.new(nil, :update)]
# updates = Arel::Array.new tuples, headers
# find_twitter_user_updates_predicate = Arel::Predicates::Equality.new updates[:id], 9
# (P) - People
updates = Arel::TwitterArray.new("ajturner")
people = Arel::Array.new([
[1,"Kate","Chapman","The 'Chook","brown","wonderchook"],
[2,"Rashaun","Snuggs","Baby firecracker","brown","snuggsi"],
[3,"Andrew","Turner","Mastah Hackah","brown","ajturner"]],
[[:id, Arel::Attributes::Integer],
[:name, Arel::Attributes::String],
[:subname, Arel::Attributes::String],
[:description, Arel::Attributes::String],
[:hair, Arel::Attributes::String],
[:twitter_name, Arel::Attributes::String]])
peoples_updates = Arel::Predicates::Equality.new(people[:twitter_name], updates[:from_user])
results = people.join(updates).on(peoples_updates).take(2).project(people[:name], people[:hair], updates[:text])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment